Skip to content

Commit 34472bd

Browse files
committed
Translate 1st p from Solution of Challenges/Focus a field on mount
1 parent 59506db commit 34472bd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/content/learn/synchronizing-with-effects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ body {
10491049
10501050
<Solution>
10511051
1052-
Calling `ref.current.focus()` during render is wrong because it is a *side effect*. Side effects should either be placed inside an event handler or be declared with `useEffect`. In this case, the side effect is _caused_ by the component appearing rather than by any specific interaction, so it makes sense to put it in an Effect.
1052+
রেন্ডারের সময় `ref.current.focus()` কল করা ভুল, কারণ এটি একটি *সাইড ইফেক্ট*। সাইড ইফেক্ট হয় একটি ইভেন্ট হ্যান্ডলারের মধ্যে রাখা উচিত অথবা `useEffect` এর মধ্যে ডিক্লেয়ার করা উচিত। এই ক্ষেত্রে, সাইড ইফেক্টটি কোনো নির্দিষ্ট ইন্টার‍্যাকশনের কারণে নয়, বরং কম্পোনেন্টটি প্রদর্শিত হওয়ার কারণে ঘটে, তাই এটিকে একটি ইফেক্টে রাখাই যুক্তিযুক্ত।
10531053
10541054
To fix the mistake, wrap the `ref.current.focus()` call into an Effect declaration. Then, to ensure that this Effect runs only on mount rather than after every render, add the empty `[]` dependencies to it.
10551055

0 commit comments

Comments
 (0)