Skip to content

Commit 0abd48e

Browse files
committed
translate toubleshoot -> im-getting-an-error-the-result-of-getsnapshot-should-be-cached
1 parent 99be244 commit 0abd48e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/content/reference/react/useSyncExternalStore.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,11 @@ function subscribe(callback) {
371371
372372
---
373373
374-
## Troubleshooting {/*troubleshooting*/}
374+
## ট্রাবলশুটিং {/*troubleshooting*/}
375375
376-
### I'm getting an error: "The result of `getSnapshot` should be cached" {/*im-getting-an-error-the-result-of-getsnapshot-should-be-cached*/}
376+
### আমি একটি এরর পাচ্ছি: "The result of `getSnapshot` should be cached" {/*im-getting-an-error-the-result-of-getsnapshot-should-be-cached*/}
377377
378-
This error means your `getSnapshot` function returns a new object every time it's called, for example:
378+
এই এররটির মানে হলো আপনার `getSnapshot` ফাংশনটি প্রতিবার কল করার সময় একটি নতুন অবজেক্ট রিটার্ন করছে, উদাহরণস্বরূপ:
379379
380380
```js {2-5}
381381
function getSnapshot() {
@@ -386,9 +386,9 @@ function getSnapshot() {
386386
}
387387
```
388388
389-
React will re-render the component if `getSnapshot` return value is different from the last time. This is why, if you always return a different value, you will enter an infinite loop and get this error.
389+
যদি `getSnapshot` এর রিটার্ন ভ্যালু আগের বারের চেয়ে ভিন্ন হয় তবে রিয়েক্ট কম্পোনেন্টটিকে রি-রেন্ডার করবে। এই কারণে, যদি আপনি সবসময় একটি ভিন্ন ভ্যালু রিটার্ন করেন, তবে আপনি একটি ইনফিনাইট লুপে প্রবেশ করবেন এবং এই এররটি পাবেন।
390390
391-
Your `getSnapshot` object should only return a different object if something has actually changed. If your store contains immutable data, you can return that data directly:
391+
আপনার `getSnapshot` অবজেক্টটির উচিত কেবল তখনই একটি ভিন্ন অবজেক্ট রিটার্ন করা যখন আসলেই কোনো কিছু পরিবর্তন হয়েছে। যদি আপনার স্টোরে ইমিউটেবল ডেটা থাকে, তবে আপনি সরাসরি সেই ডেটাটিকেই রিটার্ন করতে পারেন:
392392
393393
```js {2-3}
394394
function getSnapshot() {
@@ -397,7 +397,7 @@ function getSnapshot() {
397397
}
398398
```
399399
400-
If your store data is mutable, your `getSnapshot` function should return an immutable snapshot of it. This means it *does* need to create new objects, but it shouldn't do this for every single call. Instead, it should store the last calculated snapshot, and return the same snapshot as the last time if the data in the store has not changed. How you determine whether mutable data has changed depends on your mutable store.
400+
যদি আপনার স্টোরের ডেটা মিউটেবল (mutable) হয়, তবে আপনার `getSnapshot` ফাংশনটির উচিত সেটার একটি ইমিউটেবল স্ন্যাপশট রিটার্ন করা। এর মানে হলো এটিকে নতুন অবজেক্ট তৈরি *করতেই* হবে, তবে প্রতিবার কল করার জন্যই এটি করা উচিত নয়। এর পরিবর্তে, এটিকে সর্বশেষ ক্যালকুলেট করা স্ন্যাপশটটি স্টোর করে রাখা উচিত, এবং স্টোরের ডেটায় যদি কোনো পরিবর্তন না এসে থাকে তবে গতবার যে স্ন্যাপশটটি রিটার্ন করেছিল সেটাই পুনরায় রিটার্ন করা উচিত। মিউটেবল ডেটা পরিবর্তন হয়েছে কি না সেটা কীভাবে নির্ধারণ করবেন তা নির্ভর করে আপনার মিউটেবল স্টোরটির উপর।
401401
402402
---
403403

0 commit comments

Comments
 (0)