Skip to content

Commit bba8bdf

Browse files
committed
fix: resolve merge conflict and update Bengali translation for createRoot documentation
1 parent 4dc30d7 commit bba8bdf

1 file changed

Lines changed: 27 additions & 41 deletions

File tree

src/content/reference/react-dom/client/createRoot.md

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,10 @@ root.render(<App />);
4545
4646
* **optional** `options`: এই React root এর জন্য বিভিন্ন option সংবলিত একটি অবজেক্ট।
4747
48-
<<<<<<< HEAD
49-
* **optional** `onRecoverableError`: যখন React স্বয়ংক্রিয় ভাবে কোন error থেকে নিজেকে recover করে তখন হওয়া কলব্যাক।
50-
* **optional** `identifierPrefix`: [`useId`](/reference/react/useId) দিয়ে তৈরী হওয়া ID গুলোর জন্য React যে string prefix ব্যবহার করে। একই পেইজে যখন একাধিক rot থাকে তখন conflict এড়াতে এটা কাজে লাগে।
51-
=======
52-
* **optional** `onCaughtError`: Callback called when React catches an error in an Error Boundary. Called with the `error` caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
53-
* **optional** `onUncaughtError`: Callback called when an error is thrown and not caught by an Error Boundary. Called with the `error` that was thrown, and an `errorInfo` object containing the `componentStack`.
54-
* **optional** `onRecoverableError`: Callback called when React automatically recovers from errors. Called with an `error` React throws, and an `errorInfo` object containing the `componentStack`. Some recoverable errors may include the original error cause as `error.cause`.
55-
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page.
56-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
48+
* **optional** `onCaughtError`: যখন React একটি Error Boundary-তে কোন error ধরে তখন কল হওয়া কলব্যাক। Error Boundary যে `error` ধরেছে এবং `componentStack` সংবলিত একটি `errorInfo` অবজেক্ট দিয়ে কল হয়।
49+
* **optional** `onUncaughtError`: যখন কোন error throw হয় কিন্তু Error Boundary দিয়ে ধরা হয় না তখন কল হওয়া কলব্যাক। যে `error` throw হয়েছে এবং `componentStack` সংবলিত একটি `errorInfo` অবজেক্ট দিয়ে কল হয়।
50+
* **optional** `onRecoverableError`: যখন React স্বয়ংক্রিয়ভাবে error থেকে recover করে তখন কল হওয়া কলব্যাক। React যে `error` throw করে এবং `componentStack` সংবলিত একটি `errorInfo` অবজেক্ট দিয়ে কল হয়। কিছু recoverable error-এ মূল error কারণ `error.cause` হিসেবে অন্তর্ভুক্ত থাকতে পারে।
51+
* **optional** `identifierPrefix`: [`useId`](/reference/react/useId) দিয়ে তৈরী হওয়া ID গুলোর জন্য React যে string prefix ব্যবহার করে। একই পেইজে যখন একাধিক root থাকে তখন conflict এড়াতে এটা কাজে লাগে।
5752
5853
#### রিটার্ন {/*returns*/}
5954
@@ -95,12 +90,12 @@ React `root`-এ `<App />` দেখাবে, এবং এর মধ্যক
9590
9691
* আপনি যদি একি রুটে একাধিকবার `render` কল করেন, তাহলে আপনার পাঠানো সর্বশেষ JSX দেখানোর খাতিরে React প্রয়োজনমত DOM আপডেট করে ফেলবে। React আগেরবার রেন্ডার হওয়া ট্রি এর সাথে ["মিলিয়ে দেখবে"](/learn/preserving-and-resetting-state) এবং সিদ্ধান্ত নিবে DOM এর কোণ অংশগুলো পুনর্ব্যবহার করা যায় আর কোনগুলো আবার বানাতে হবে। একই রুটে আবার `render` কল করা রুট কম্পোনেন্টে [`set` function](/reference/react/useState#setstate) কল করার মতঃ React অপ্রয়োজনীয় DOM আপডেট এড়ানোর চেষ্টা করে।
9792
98-
* Although rendering is synchronous once it starts, `root.render(...)` is not. This means code after `root.render()` may run before any effects (`useLayoutEffect`, `useEffect`) of that specific render are fired. This is usually fine and rarely needs adjustment. In rare cases where effect timing matters, you can wrap `root.render(...)` in [`flushSync`](https://react.dev/reference/react-dom/client/flushSync) to ensure the initial render runs fully synchronously.
93+
* যদিও rendering শুরু হওয়ার পর synchronous, `root.render(...)` synchronous নয়। এর মানে হল `root.render()` এর পরের কোড ওই নির্দিষ্ট render এর কোন effects (`useLayoutEffect`, `useEffect`) fire হওয়ার আগেই রান হতে পারে। এটা সাধারণত ঠিক আছে এবং খুব কমই adjustment প্রয়োজন হয়। বিরল ক্ষেত্রে যেখানে effect timing গুরুত্বপূর্ণ, আপনি `root.render(...)` কে [`flushSync`](https://react.dev/reference/react-dom/client/flushSync) দিয়ে wrap করতে পারেন যাতে initial render সম্পূর্ণভাবে synchronously রান হয়।
9994
10095
```js
10196
const root = createRoot(document.getElementById('root'));
10297
root.render(<App />);
103-
// 🚩 The HTML will not include the rendered <App /> yet:
98+
// 🚩 HTML এ এখনো rendered <App /> অন্তর্ভুক্ত হবে নাঃ
10499
console.log(document.body.innerHTML);
105100
```
106101
@@ -220,7 +215,7 @@ function Counter() {
220215
221216
<Pitfall>
222217
223-
**যেসব অ্যাপ server rendering বা static generation ব্যবহার করে তাদেরকে অবশ্যই `createRoot` এর জায়গায় [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) কল করতে হবে।** React তখন আপনার HTML থেকে DOM নোডগুলো ধ্বংস এবং পুনরায় তৈরি করার বদলে *hydrate* (পুনর্ব্যবহার) করবে।
218+
**যেসব অ্যাপ server rendering বা static generation ব্যবহার করে তাদেরকে অবশ্যই `createRoot` এর বদলে [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) কল করতে হবে।** React তখন আপনার HTML থেকে DOM নোডগুলো ধ্বংস এবং পুনরায় তৈরি করার বদলে *hydrate* (পুনর্ব্যবহার) করবে।
224219
225220
</Pitfall>
226221
@@ -358,13 +353,9 @@ export default function App({counter}) {
358353
359354
সাধারণত `render` একাধিকবার কল করা হয় না, বরং আপনার কম্পোনেট গুলোই [state আপডেট](/reference/react/useState) করে।
360355
361-
<<<<<<< HEAD
362-
---
363-
## ট্রাবলশ্যুট {/*troubleshooting*/}
364-
=======
365-
### Error logging in production {/*error-logging-in-production*/}
356+
### প্রোডাকশনে Error logging {/*error-logging-in-production*/}
366357
367-
By default, React will log all errors to the console. To implement your own error reporting, you can provide the optional error handler root options `onUncaughtError`, `onCaughtError` and `onRecoverableError`:
358+
ডিফল্টভাবে, React সকল error কনসোলে log করে। আপনার নিজস্ব error reporting implement করার জন্য, আপনি optional error handler root options `onUncaughtError`, `onCaughtError` এবং `onRecoverableError` প্রদান করতে পারেনঃ
368359
369360
```js [[1, 6, "onCaughtError"], [2, 6, "error", 1], [3, 6, "errorInfo"], [4, 10, "componentStack", 15]]
370361
import { createRoot } from "react-dom/client";
@@ -383,19 +374,19 @@ const root = createRoot(container, {
383374
});
384375
```
385376
386-
The <CodeStep step={1}>onCaughtError</CodeStep> option is a function called with two arguments:
377+
<CodeStep step={1}>onCaughtError</CodeStep> অপশন হল একটি ফাংশন যা দুটি argument দিয়ে কল হয়ঃ
387378
388-
1. The <CodeStep step={2}>error</CodeStep> that was thrown.
389-
2. An <CodeStep step={3}>errorInfo</CodeStep> object that contains the <CodeStep step={4}>componentStack</CodeStep> of the error.
379+
1. যে <CodeStep step={2}>error</CodeStep> throw হয়েছে।
380+
2. একটি <CodeStep step={3}>errorInfo</CodeStep> অবজেক্ট যাতে error এর <CodeStep step={4}>componentStack</CodeStep> রয়েছে।
390381
391-
Together with `onUncaughtError` and `onRecoverableError`, you can can implement your own error reporting system:
382+
`onUncaughtError` এবং `onRecoverableError` এর সাথে একত্রে, আপনি আপনার নিজস্ব error reporting system implement করতে পারেনঃ
392383
393384
<Sandpack>
394385
395386
```js src/reportError.js
396387
function reportError({ type, error, errorInfo }) {
397-
// The specific implementation is up to you.
398-
// `console.error()` is only used for demonstration purposes.
388+
// নির্দিষ্ট implementation আপনার উপর নির্ভর করে।
389+
// `console.error()` শুধুমাত্র demonstration উদ্দেশ্যে ব্যবহৃত হয়েছে।
399390
console.error(type, error, "Component Stack: ");
400391
console.error("Component Stack: ", errorInfo.componentStack);
401392
}
@@ -426,9 +417,9 @@ import {
426417

427418
const container = document.getElementById("root");
428419
const root = createRoot(container, {
429-
// Keep in mind to remove these options in development to leverage
430-
// React's default handlers or implement your own overlay for development.
431-
// The handlers are only specfied unconditionally here for demonstration purposes.
420+
// মনে রাখবেন development এ এই options গুলো সরিয়ে দিন যাতে
421+
// React এর default handlers ব্যবহার করতে পারেন বা development এর জন্য আপনার নিজস্ব overlay implement করতে পারেন।
422+
// handlers গুলো এখানে শুধুমাত্র demonstration উদ্দেশ্যে unconditionally specify করা হয়েছে।
432423
onCaughtError: onCaughtErrorProd,
433424
onRecoverableError: onRecoverableErrorProd,
434425
onUncaughtError: onUncaughtErrorProd,
@@ -484,7 +475,6 @@ export default function App() {
484475
</Sandpack>
485476
486477
## Troubleshooting {/*troubleshooting*/}
487-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
488478
489479
### একটা রুট তৈরী করবার পরও কিছুই দেখাচ্ছে না {/*ive-created-a-root-but-nothing-is-displayed*/}
490480
@@ -502,33 +492,29 @@ root.render(<App />);
502492
503493
---
504494
505-
<<<<<<< HEAD
506-
### একটা এরর দেখাচ্ছেঃ "Target container is not a DOM element" {/*im-getting-an-error-target-container-is-not-a-dom-element*/}
507-
=======
508-
### I'm getting an error: "You passed a second argument to root.render" {/*im-getting-an-error-you-passed-a-second-argument-to-root-render*/}
495+
### একটা এরর দেখাচ্ছেঃ "You passed a second argument to root.render" {/*im-getting-an-error-you-passed-a-second-argument-to-root-render*/}
509496
510-
A common mistake is to pass the options for `createRoot` to `root.render(...)`:
497+
একটি সাধারণ ভুল হল `createRoot` এর options `root.render(...)` এ পাঠানোঃ
511498
512499
<ConsoleBlock level="error">
513500
514501
Warning: You passed a second argument to root.render(...) but it only accepts one argument.
515502
516503
</ConsoleBlock>
517504
518-
To fix, pass the root options to `createRoot(...)`, not `root.render(...)`:
505+
এটা ঠিক করতে, root options `root.render(...)` এ না দিয়ে `createRoot(...)` এ দিনঃ
519506
```js {2,5}
520-
// 🚩 Wrong: root.render only takes one argument.
507+
// 🚩 ভুলঃ root.render শুধুমাত্র একটি argument নেয়।
521508
root.render(App, {onUncaughtError});
522509

523-
//Correct: pass options to createRoot.
510+
//সঠিকঃ options createRoot এ দিন।
524511
const root = createRoot(container, {onUncaughtError});
525512
root.render(<App />);
526513
```
527514
528515
---
529516
530-
### I'm getting an error: "Target container is not a DOM element" {/*im-getting-an-error-target-container-is-not-a-dom-element*/}
531-
>>>>>>> 50d6991ca6652f4bc4c985cf0c0e593864f2cc91
517+
### একটা এরর দেখাচ্ছেঃ "Target container is not a DOM element" {/*im-getting-an-error-target-container-is-not-a-dom-element*/}
532518
533519
এই এররের অর্থ হল, আপনি যা `createRoot`-এ পাঠাচ্ছেন তা DOM নোড না।
534520
@@ -543,14 +529,14 @@ root.render(<App />);
543529
544530
উদাহরণস্বরূপ, যদি `domNode` `null` হয়, এর অর্থ [`getElementById`](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById)`null` রিটার্ন করেছে। এটা হবে যদি আপনার কল করার সময়ে ডকুমেন্টে ওই ID এর কোন নোড না থাকে। এর কিছু কারণ হতে পারে এমনঃ
545531
546-
1. হতে পারে আপনি যেই ID খুজছেন সেটা আপনার HTML এ ব্যবহার করা ID থেকে আলাদা। টাইপিং এ ভুল হয়েছে কি না নিশ্চিত হন!
532+
1. হতে পারে আপনার যেই ID খুজছেন সেটা আপনার HTML এ ব্যবহার করা ID থেকে আলাদা। টাইপিং এ ভুল হয়েছে কি নিশ্চিত হন!
547533
2. হয়ত আপনার বান্ডলের `<script>` ট্যাগ HTML-এ *এর পরে* কোন DOM নোড "দেখতে" পারছে না।
548534
549535
এই এরর পাবার আরেকটি কমন কারণ হল `createRoot(domNode)` এর বদলে `createRoot(<App />)` লেখা।
550536
551537
---
552538
553-
### একটা এরর দেখাচ্ছেঃ "Functions are not valid as a React child." {/*im-getting-an-error-functions-are-not-valid-as-a-react-child*/}
539+
### I'm getting an error: "Functions are not valid as a React child." {/*im-getting-an-error-functions-are-not-valid-as-a-react-child*/}
554540
555541
এই এররের অর্থ হল, আপনি যা `root.render` এ পাঠাচ্ছেন তা React কম্পোনেন্ট নয়।
556542
@@ -578,7 +564,7 @@ root.render(createApp());
578564
579565
### সার্ভার থেকে রেন্ডার হওয়া HTML একদম শুরু থেকে তৈরী হচ্ছে {/*my-server-rendered-html-gets-re-created-from-scratch*/}
580566
581-
যদি আপনার অ্যাপ সার্ভার থেকে রেন্ডার হয়ে থাকে এবং React এর তৈরী করা ইনিশিয়াল HTML থাকে ওতে, আপনি খেয়াল করবেন যে `root.render` কল করলে সব HTML মুছে যায়, এবং একদম শুরু থেকে সব DOM নোড তৈরী হয়। এটা ধীরতর হতে পারে, ফোকাস এবং স্ক্রল পজিশন রিসেট হয়ে যায়, এবং ব্যবহারকারীর ইনপুটও হারিয়ে যেতে পারে।
567+
যদি আপনার অ্যাপ সার্ভার থেকে রেন্ডার হয়ে থাকে এবং React এর তৈরী করা ইনিশিয়াল HTML থাকে ওতে, আপনি খেয়াল করবেন যে `root.render` কল করলে সব HTML মুছে যায়, এবং একদম শুরু থেকে সব DOM নোড তৈরি হয়। এটা ধীরতর হতে পারে, ফোকাস এবং স্ক্রল পজিশন রিসেট হয়ে যায়, এবং ব্যবহারকারীর ইনপুটও হারিয়ে যেতে পারে।
582568
583569
সার্ভার থেকে রেন্ডার হওয়া অ্যাপের ক্ষেত্রে অবশ্যই `createRoot` এর বদলে [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) এর ব্যবহার করতে হবেঃ
584570

0 commit comments

Comments
 (0)