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/memo.md
+15-24Lines changed: 15 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,11 +118,7 @@ label {
118
118
119
119
#### আপনি কি সর্বত্র `memo` যোগ করবেন? {/*should-you-add-memo-everywhere*/}
120
120
121
-
<<<<<<< HEAD
122
121
যদি আপনার অ্যাপ এই সাইটের মতো হয়, এবং বেশিরভাগ ইন্টারেকশন ভারী (যেমন একটি পৃষ্ঠা বা পুরো অংশ প্রতিস্থাপন করা) হয়, তাহলে মেমোয়াইজেশন সাধারণত অপ্রয়োজনীয়। অন্যদিকে, যদি আপনার অ্যাপ একটি ড্রয়িং এডিটরের মতো হয়, এবং বেশিরভাগ ইন্টারেকশন সূক্ষ্ম (যেমন shape সরানো), তাহলে মেমোয়াইজেশন আপনার কাছে খুব উপকারী মনে হতে পারে।
123
-
=======
124
-
If your app is like this site, and most interactions are coarse (like replacing a page or an entire section), memoization is usually unnecessary. On the other hand, if your app is more like a drawing editor, and most interactions are granular (like moving shapes), then you might find memoization very helpful.
125
-
>>>>>>> 2774ddfa0c39b8c2f0563b987dcb90a01ee723cf
126
122
127
123
`memo` দ্বারা অপ্টিমাইজেশন তখনই মূল্যবান যখন আপনার কম্পোনেন্ট একই নির্দিষ্ট প্রপসের সাথে প্রায়শই পুনরায় রেন্ডার হয়, এবং এর পুনরায় রেন্ডার লজিক খরচবহুল। যদি আপনার কম্পোনেন্ট পুনরায় রেন্ডার হওয়ার সময় কোনো লক্ষণীয় ধীরতা না থাকে, তাহলে `memo` অপ্রয়োজনীয়। মনে রাখবেন, যদি আপনার কম্পোনেন্টের পাস করা প্রপস *সর্বদা আলাদা* হয়, যেমন যদি আপনি একটি অবজেক্ট বা রেন্ডারিং সময় ডিফাইন করা একটি সাধারণ ফাংশন পাস করেন। এই কারণে আপনার প্রায়শই [`useMemo`](/reference/react/useMemo#skipping-re-rendering-of-components) এবং [`useCallback`](/reference/react/useCallback#skipping-re-rendering-of-components) এর সাথে `memo` ব্যবহার করা প্রয়োজন হবে।
128
124
@@ -367,17 +363,13 @@ function arePropsEqual(oldProps, newProps) {
367
363
368
364
---
369
365
370
-
<<<<<<< HEAD
371
-
## ট্রাবলশুটিং {/*troubleshooting*/}
372
-
### আমার কম্পোনেন্ট পুনরায় রেন্ডার হয় যখন একটি প্রপ অবজেক্ট, অ্যারে, অথবা ফাংশন হয় {/*my-component-rerenders-when-a-prop-is-an-object-or-array*/}
373
-
=======
374
-
### Do I still need React.memo if I use React Compiler? {/*react-compiler-memo*/}
366
+
### যদি আমি React কম্পাইলার ব্যবহার করি তাও কি আমার কি React.memo লাগবে? {/*react-compiler-memo*/}
375
367
376
-
When you enable [React Compiler](/learn/react-compiler), you typically don't need`React.memo`anymore. The compiler automatically optimizes component re-rendering for you.
368
+
যখন আপনি [React Compiler](/learn/react-compiler) এনাবল করেন, তখন সাধারণত`React.memo`এর প্রয়োজন হয় না আর। কম্পাইলার স্বয়ংক্রিয়ভাবে আপনার কম্পোনেন্ট রি-রেন্ডারিং অপ্টিমাইজ করে দেয়।
377
369
378
-
Here's how it works:
370
+
এটা এভাবে কাজ করে:
379
371
380
-
**Without React Compiler**, you need `React.memo`to prevent unnecessary re-renders:
**With React Compiler enabled**, the same optimization happens automatically:
401
+
**React কম্পাইলার সক্রিয় অবস্থায়**, একই অপটিমাইজেশন স্বয়ংক্রিয় ভাবে হবে:
410
402
411
403
```js
412
404
// No memo needed - compiler prevents re-renders automatically
@@ -416,7 +408,7 @@ function ExpensiveChild({ name }) {
416
408
}
417
409
```
418
410
419
-
Here's the key part of what the React Compiler generates:
411
+
React কম্পাইলার যা তৈরি করে তার মূল অংশ হল এটা:
420
412
421
413
```js {6-12}
422
414
functionParent() {
@@ -435,25 +427,24 @@ function Parent() {
435
427
}
436
428
```
437
429
438
-
Notice the highlighted lines: The compiler wraps `<ExpensiveChild name="John" />` in a cache check. Since the `name` prop is always `"John"`, this JSX is created once and reused on every parent re-render. This is exactly what `React.memo`does - it prevents the child from re-rendering when its props haven't changed.
430
+
হাইলাইট করা লাইনগুলো খেয়াল করুন: কম্পাইলার `<ExpensiveChild name="John" />`-কে একটি cache check দিয়ে ঘিরে রাখে। যেহেতু `name` prop সবসময় `"John"`, এই JSX একবারই তৈরি হয় এবং প্রতিটি parent re-render-এর সময় পুনরায় ব্যবহার হয়। ঠিক এটাই `React.memo`করে—props না বদলালে child re-render হওয়া থামিয়ে দেয়।
439
431
440
-
The React Compiler automatically:
441
-
1.Tracks that the `name` prop passed to `ExpensiveChild` hasn't changed
442
-
2.Reuses the previously created JSX for `<ExpensiveChild name="John" />`
443
-
3.Skips re-rendering `ExpensiveChild` entirely
432
+
React Compiler স্বয়ংক্রিয়ভাবে:
433
+
1.ট্র্যাক করে যে `ExpensiveChild`-এ পাঠানো `name` prop বদলায়নি
434
+
2.`<ExpensiveChild name="John" />`-এর জন্য আগে তৈরি করা JSX-টাই পুনঃব্যবহার করে
435
+
3.`ExpensiveChild`-কে পুরোপুরি re-render করা স্কিপ করে
444
436
445
-
This means **you can safely remove `React.memo`from your components when using React Compiler**. The compiler provides the same optimization automatically, making your code cleaner and easier to maintain.
437
+
এর মানে হলো **React Compiler ব্যবহার করলে নির্ভয়ে কম্পোনেন্টগুলো থেকে `React.memo`সরিয়ে দিতে পারেন**। কম্পাইলার একই অপ্টিমাইজেশন স্বয়ংক্রিয়ভাবে দেয়, ফলে কোড আরও পরিচ্ছন্ন হয় এবং মেইনটেইন করাও সহজ হয়।
446
438
447
439
<Note>
448
440
449
-
The compiler's optimization is actually more comprehensive than `React.memo`. It also memoizes intermediate values and expensive computations within your components, similar to combining `React.memo`with`useMemo`throughout your component tree.
441
+
কম্পাইলারের অপ্টিমাইজেশন আসলে `React.memo`-এর থেকেও বেশি বিস্তৃত। এটি কম্পোনেন্টের ভেতরের মধ্যবর্তী মান (intermediate values) ও ব্যয়বহুল গণনাগুলোও memoize করে, যা পুরো কম্পোনেন্ট ট্রি জুড়ে `React.memo`এবং`useMemo`একসাথে ব্যবহারের মতো ফল দেয়।
450
442
451
443
</Note>
452
444
453
445
---
454
446
455
-
## Troubleshooting {/*troubleshooting*/}
456
-
### My component re-renders when a prop is an object, array, or function {/*my-component-rerenders-when-a-prop-is-an-object-or-array*/}
457
-
>>>>>>> 2774ddfa0c39b8c2f0563b987dcb90a01ee723cf
447
+
## ট্রাবলশুটিং {/*troubleshooting*/}
448
+
### আমার কম্পোনেন্ট পুনরায় রেন্ডার হয় যখন একটি প্রপ অবজেক্ট, অ্যারে, অথবা ফাংশন হয় {/*my-component-rerenders-when-a-prop-is-an-object-or-array*/}
458
449
459
450
React পুরানো এবং নতুন প্রপসগুলি shallow equality দ্বারা তুলনা করেঃ অর্থাৎ, এটি বিবেচনা করে যে প্রতিটি নতুন প্রপ পুরানো প্রপের সাথে রেফারেন্স-সমান কিনা। যদি আপনি প্রতি বার প্যারেন্ট পুনরায় রেন্ডার হলে একটি নতুন অবজেক্ট বা অ্যারে তৈরি করেন, এমনকি যদি প্রতিটি উপাদান একই হয়, React এটিকে পরিবর্তিত হিসেবে বিবেচনা করবে। একই ভাবে, যদি আপনি প্যারেন্ট কম্পোনেন্ট রেন্ডার করার সময় একটি নতুন ফাংশন তৈরি করেন, React এটিকে পরিবর্তিত হিসেবে বিবেচনা করবে, এমনকি যদি ফাংশনের ডেফিনিশন একই হয়। এটি এড়াতে, [প্রপসগুলি সরল করুন অথবা প্যারেন্ট কম্পোনেন্টে প্রপসগুলি মেমোয়াইজ করুন](#minimizing-props-changes)।
0 commit comments