Skip to content

Commit ca9ece2

Browse files
authored
Fix missing translate (#1107)
* Fix missing translate * Fix missing translate
1 parent e7e1157 commit ca9ece2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,28 +600,28 @@ React는 마지막 예시와 같은 버그를 찾기 위해 개발 중에 컴포
600600
601601
<Pitfall>
602602
603-
#### Don't use refs to prevent Effects from firing {/*dont-use-refs-to-prevent-effects-from-firing*/}
603+
#### Effect가 두 번 실행되는 것을 막기위해 ref를 사용하지 마세요 {/*dont-use-refs-to-prevent-effects-from-firing*/}
604604
605-
A common pitfall for preventing Effects firing twice in development is to use a `ref` to prevent the Effect from running more than once. For example, you could "fix" the above bug with a `useRef`:
605+
Effect가 개발 모드에서 두 번 실행되는 것을 막으려다 흔히 빠지는 함정은 `ref`를 사용해 Effect가 한 번만 실행되도록 하는 것입니다. 예를 들어 위의 버그를 `useRef`를 사용하여 "수정"하려고 할 수도 있습니다:
606606
607607
```js {1,3-4}
608608
const connectionRef = useRef(null);
609609
useEffect(() => {
610-
// 🚩 This wont fix the bug!!!
610+
// 🚩 버그를 수정하지 않습니다!!!
611611
if (!connectionRef.current) {
612612
connectionRef.current = createConnection();
613613
connectionRef.current.connect();
614614
}
615615
}, []);
616616
```
617617
618-
This makes it so you only see `"Connecting..."` once in development, but it doesn't fix the bug.
618+
이렇게 하면 개발 모드에서 `"연결 중..."`이 한 번만 보이지만 버그가 수정된 건 아닙니다.
619619
620-
When the user navigates away, the connection still isn't closed and when they navigate back, a new connection is created. As the user navigates across the app, the connections would keep piling up, the same as it would before the "fix".
620+
사용자가 다른 곳에 가더라도 연결이 끊어지지 않고 사용자가 다시 돌아왔을 때 새로운 연결이 생성됩니다. 사용자가 앱을 탐색하면 버그가 수정되기 전처럼 연결이 계속 쌓이게 됩니다.
621621
622-
To fix the bug, it is not enough to just make the Effect run once. The effect needs to work after re-mounting, which means the connection needs to be cleaned up like in the solution above.
622+
버그를 수정하기 위해선 Effect를 단순히 한 번만 실행되도록 만드는 것으로는 부족합니다. Effect는 위에 있는 예시가 연결을 클린업 한것처럼 다시 마운트된 이후에도 제대로 동작해야 합니다.
623623
624-
See the examples below for how to handle common patterns.
624+
아래에 있는 일반적인 패턴을 다루는 예시를 살펴보세요.
625625
626626
</Pitfall>
627627

0 commit comments

Comments
 (0)