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
+13-18Lines changed: 13 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -363,17 +363,13 @@ function arePropsEqual(oldProps, newProps) {
363
363
364
364
---
365
365
366
-
<<<<<<< HEAD
367
-
## ট্রাবলশুটিং {/*troubleshooting*/}
368
-
### আমার কম্পোনেন্ট পুনরায় রেন্ডার হয় যখন একটি প্রপ অবজেক্ট, অ্যারে, অথবা ফাংশন হয় {/*my-component-rerenders-when-a-prop-is-an-object-or-array*/}
369
-
=======
370
-
### Do I still need React.memo if I use React Compiler? {/*react-compiler-memo*/}
366
+
### যদি আমি React কম্পাইলার ব্যবহার করি তাও কি আমার কি React.memo লাগবে? {/*react-compiler-memo*/}
371
367
372
368
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.
373
369
374
370
Here's how it works:
375
371
376
-
**Without React Compiler**, you need `React.memo`to prevent unnecessary re-renders:
**With React Compiler enabled**, the same optimization happens automatically:
401
+
**React কম্পাইলার সক্রিয় অবস্থায়**, একই অপটিমাইজেশন স্বয়ংক্রিয় ভাবে হবে:
406
402
407
403
```js
408
404
// No memo needed - compiler prevents re-renders automatically
@@ -412,7 +408,7 @@ function ExpensiveChild({ name }) {
412
408
}
413
409
```
414
410
415
-
Here's the key part of what the React Compiler generates:
411
+
React কম্পাইলার যা তৈরি করে তার মূল অংশ হল এটা:
416
412
417
413
```js {6-12}
418
414
functionParent() {
@@ -431,25 +427,24 @@ function Parent() {
431
427
}
432
428
```
433
429
434
-
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 হওয়া থামিয়ে দেয়।
435
431
436
-
The React Compiler automatically:
437
-
1.Tracks that the `name` prop passed to `ExpensiveChild` hasn't changed
438
-
2.Reuses the previously created JSX for `<ExpensiveChild name="John" />`
439
-
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 করা স্কিপ করে
440
436
441
-
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`সরিয়ে দিতে পারেন**। কম্পাইলার একই অপ্টিমাইজেশন স্বয়ংক্রিয়ভাবে দেয়, ফলে কোড আরও পরিচ্ছন্ন হয় এবং মেইনটেইন করাও সহজ হয়।
442
438
443
439
<Note>
444
440
445
-
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`একসাথে ব্যবহারের মতো ফল দেয়।
446
442
447
443
</Note>
448
444
449
445
---
450
446
451
-
## Troubleshooting {/*troubleshooting*/}
452
-
### My component re-renders when a prop is an object, array, or function {/*my-component-rerenders-when-a-prop-is-an-object-or-array*/}
453
-
>>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9
447
+
## ট্রাবলশুটিং {/*troubleshooting*/}
448
+
### আমার কম্পোনেন্ট পুনরায় রেন্ডার হয় যখন একটি প্রপ অবজেক্ট, অ্যারে, অথবা ফাংশন হয় {/*my-component-rerenders-when-a-prop-is-an-object-or-array*/}
454
449
455
450
React পুরানো এবং নতুন প্রপসগুলি shallow equality দ্বারা তুলনা করেঃ অর্থাৎ, এটি বিবেচনা করে যে প্রতিটি নতুন প্রপ পুরানো প্রপের সাথে রেফারেন্স-সমান কিনা। যদি আপনি প্রতি বার প্যারেন্ট পুনরায় রেন্ডার হলে একটি নতুন অবজেক্ট বা অ্যারে তৈরি করেন, এমনকি যদি প্রতিটি উপাদান একই হয়, React এটিকে পরিবর্তিত হিসেবে বিবেচনা করবে। একই ভাবে, যদি আপনি প্যারেন্ট কম্পোনেন্ট রেন্ডার করার সময় একটি নতুন ফাংশন তৈরি করেন, React এটিকে পরিবর্তিত হিসেবে বিবেচনা করবে, এমনকি যদি ফাংশনের ডেফিনিশন একই হয়। এটি এড়াতে, [প্রপসগুলি সরল করুন অথবা প্যারেন্ট কম্পোনেন্টে প্রপসগুলি মেমোয়াইজ করুন](#minimizing-props-changes)।
0 commit comments