You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/reference/react/useSyncExternalStore.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -326,14 +326,14 @@ function subscribe(callback) {
326
326
327
327
---
328
328
329
-
### Adding support for server rendering {/*adding-support-for-server-rendering*/}
329
+
### সার্ভার রেন্ডারিংয়ের সাপোর্ট যুক্ত করা {/*adding-support-for-server-rendering*/}
330
330
331
-
If your React app uses [server rendering,](/reference/react-dom/server) your React components will also run outside the browser environment to generate the initial HTML. This creates a few challenges when connecting to an external store:
331
+
যদি আপনার রিয়েক্ট অ্যাপ্লিকেশনটি [সার্ভার রেন্ডারিং](/reference/react-dom/server) ব্যবহার করে, তবে আপনার রিয়েক্ট কম্পোনেন্ট ব্রাউজার এনভায়রনমেন্টের বাইরেও রান করবে যাতে ইনিশিয়াল (প্রাথমিক) HTML তৈরি করা যায়। এক্সটার্নাল স্টোরের সাথে সংযুক্ত থাকতে এটি বেশ কয়েকটি চ্যালেঞ্জ তৈরি করে:
332
332
333
-
- If you're connecting to a browser-only API, it won't work because it does not exist on the server.
334
-
- If you're connecting to a third-party data store, you'll need its data to match between the server and client.
333
+
- আপনি যদি কোনো ব্রাউজার-অনলি API এর সাথে কানেক্ট করতে চান, তবে সেটি কাজ করবে না কারণ সার্ভারে এর কোনো অস্তিত্ব নেই।
334
+
- যদি আপনি কোনো থার্ড-পার্টি ডেটা স্টোরের সাথে কানেক্ট করেন, আপনাকে লক্ষ্য রাখতে হবে যেন এর ডেটা সার্ভার এবং ক্লায়েন্টের মধ্যে মিলে যায় (match)।
335
335
336
-
To solve these issues, pass a `getServerSnapshot` function as the third argument to `useSyncExternalStore`:
336
+
এই সমস্যাগুলোর সমাধান করতে, `useSyncExternalStore`-এর তৃতীয় আর্গুমেন্ট হিসেবে একটি `getServerSnapshot` ফাংশন পাস করুন:
337
337
338
338
```js {4,12-14}
339
339
import { useSyncExternalStore } from'react';
@@ -356,16 +356,16 @@ function subscribe(callback) {
356
356
}
357
357
```
358
358
359
-
The `getServerSnapshot`function is similar to `getSnapshot`, but it runs only in two situations:
359
+
`getServerSnapshot`ফাংশনটি `getSnapshot` এর মতোই, কিন্তু এটি শুধু দুটি পরিস্থিতিতে রান করে:
360
360
361
-
- It runs on the server when generating the HTML.
362
-
- It runs on the client during [hydration](/reference/react-dom/client/hydrateRoot), i.e. when React takes the server HTML and makes it interactive.
361
+
- এটি HTML জেনারেট করার সময় সার্ভারে রান করে।
362
+
- এটি [হাইড্রেশনের (hydration)](/reference/react-dom/client/hydrateRoot) সময় ক্লায়েন্টে রান করে, অর্থাৎ যখন রিয়েক্ট সার্ভারের HTML কে ইন্টারঅ্যাক্টিভ করে তোলে।
363
363
364
-
This lets you provide the initial snapshot value which will be used before the app becomes interactive. If there is no meaningful initial value for the server rendering, omit this argument to [force rendering on the client.](/reference/react/Suspense#providing-a-fallback-for-server-errors-and-server-only-content)
364
+
এটি আপনাকে ইনিশিয়াল স্ন্যাপশট ভ্যালু প্রদান করার সুযোগ দেয় যা অ্যাপটি পুরোপুরি ইন্টারঅ্যাক্টিভ হওয়ার আগে ব্যবহৃত হবে। সার্ভার রেন্ডারিংয়ের জন্য যদি কোনো অর্থপূর্ণ ইনিশিয়াল ভ্যালু না থাকে, তবে এই আর্গুমেন্টটি বাদ দিন যাতে করে শুধুমাত্র [ক্লায়েন্টে রেন্ডার করতে বাধ্য করা যায়।](/reference/react/Suspense#providing-a-fallback-for-server-errors-and-server-only-content)
365
365
366
366
<Note>
367
367
368
-
Make sure that`getServerSnapshot`returns the same exact data on the initial client render as it returned on the server. For example, if`getServerSnapshot`returned some prepopulated store content on the server, you need to transfer this content to the client. One way to do this is to emit a `<script>`tag during server rendering that sets a global like `window.MY_STORE_DATA`, and read from that global on the client in `getServerSnapshot`. Your external store should provide instructions on how to do that.
368
+
নিশ্চিত করুন যে `getServerSnapshot` ইনিশিয়াল ক্লায়েন্ট রেন্ডারের সময় হুবহু একই ডেটা রিটার্ন করে যা এটি সার্ভারে রিটার্ন করেছিল। উদাহরণস্বরূপ, যদি `getServerSnapshot` সার্ভারে আগে থেকে পপুলেট (populate) করা কিছু স্টোর কনটেন্ট রিটার্ন করে থাকে, তবে আপনাকে এই কনটেন্ট ক্লায়েন্টে ট্রান্সফার করতে হবে। এটি করার একটি উপায় হলো সার্ভার রেন্ডারিংয়ের সময় একটি `<script>` ট্যাগ এমিট করা যা `window.MY_STORE_DATA` এর মতো কোনো গ্লোবাল সেট করবে, এবং ক্লায়েন্টের `getServerSnapshot` এ ওই গ্লোবালটি রিড করা। আপনার এক্সটার্নাল স্টোরটির সাধারণত এটি কীভাবে করতে হবে সেই বিষয়ে নির্দেশনা দেওয়া উচিত।
0 commit comments