Skip to content

Commit 6af13d2

Browse files
committed
docs: translate remaining English passages in useEffect.md (#1496)
1 parent bedf06b commit 6af13d2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

โ€Žsrc/content/reference/react/useEffect.mdโ€Ž

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ button { margin: 5px; }
897897
898898
### Effect๋ฅผ ์ด์šฉํ•œ ๋ฐ์ดํ„ฐ ํŽ˜์นญ {/*fetching-data-with-effects*/}
899899
900-
You can use an Effect to fetch data for your component. Note that [if you use a framework,](/learn/start-a-new-react-project#full-stack-frameworks) using your framework's data fetching mechanism will be a lot more efficient than writing Effects manually.
900+
Effect๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปดํฌ๋„ŒํŠธ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ํŽ˜์นญํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. [ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด](/learn/start-a-new-react-project#full-stack-frameworks) Effect๋ฅผ ์ง์ ‘ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ํ”„๋ ˆ์ž„์›Œํฌ์˜ ๋ฐ์ดํ„ฐ ํŽ˜์นญ ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ํ›จ์”ฌ ๋” ํšจ์œจ์ ์ด๋ผ๋Š” ์ ์— ์œ ์˜ํ•˜์„ธ์š”.
901901
902902
๋งŒ์•ฝ ์ง์ ‘ Effect๋ฅผ ์ž‘์„ฑํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ํŽ˜์นญํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด, ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
903903
@@ -1050,8 +1050,8 @@ Effect ๋‚ด๋ถ€์—์„œ `fetch` ํ˜ธ์ถœ์„ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ์€ ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด
10501050
10511051
์ด๋Ÿฌํ•œ ๋‹จ์ ์€ React๋งŒ ํ•ด๋‹น๋˜๋Š” ๊ฒƒ์ด ์•„๋‹™๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ํŽ˜์นญํ•  ๋•Œ๋„ ํ•ด๋‹น๋ฉ๋‹ˆ๋‹ค. ๋ผ์šฐํŒ…๊ณผ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋ฐ์ดํ„ฐ ํŽ˜์นญ์€ ์„ธ๋ถ€์ ์ธ ์‚ฌํ•ญ์ด ๋งŽ์œผ๋ฏ€๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ ‘๊ทผ ๋ฐฉ์‹์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.
10521052
1053-
- **If you use a [framework](/learn/start-a-new-react-project#full-stack-frameworks), use its built-in data fetching mechanism.** Modern React frameworks have integrated data fetching mechanisms that are efficient and don't suffer from the above pitfalls.
1054-
- **Otherwise, consider using or building a client-side cache.** Popular open source solutions include [React Query](https://tanstack.com/query/latest/), [useSWR](https://swr.vercel.app/), and [React Router 6.4+.](https://beta.reactrouter.com/en/main/start/overview) You can build your own solution too, in which case you would use Effects under the hood but also add logic for deduplicating requests, caching responses, and avoiding network waterfalls (by preloading data or hoisting data requirements to routes).
1053+
- **[ํ”„๋ ˆ์ž„์›Œํฌ](/learn/start-a-new-react-project#full-stack-frameworks)๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, ๋‚ด์žฅ๋œ ๋ฐ์ดํ„ฐ ํŽ˜์นญ ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ์‚ฌ์šฉํ•˜์„ธ์š”.** ์ตœ์‹  React ํ”„๋ ˆ์ž„์›Œํฌ๋Š” ํšจ์œจ์ ์ด๋ฉฐ ์œ„์™€ ๊ฐ™์€ ๋‹จ์ ์—์„œ ์ž์œ ๋กœ์šด ํ†ตํ•ฉ ๋ฐ์ดํ„ฐ ํŽ˜์นญ ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ๊ฐ–์ถ”๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
1054+
- **๊ทธ๋ ‡์ง€ ์•Š๋‹ค๋ฉด, ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด๋“œ ์บ์‹œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ์ง์ ‘ ๋งŒ๋“œ๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด ๋ณด์„ธ์š”.** ์ธ๊ธฐ ์žˆ๋Š” ์˜คํ”ˆ ์†Œ์Šค ์†”๋ฃจ์…˜์œผ๋กœ๋Š” [React Query](https://tanstack.com/query/latest/), [useSWR](https://swr.vercel.app/), [React Router 6.4+](https://beta.reactrouter.com/en/main/start/overview) ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ง์ ‘ ์†”๋ฃจ์…˜์„ ๊ตฌ์ถ•ํ•  ์ˆ˜๋„ ์žˆ๋Š”๋ฐ, ์ด ๊ฒฝ์šฐ ๋‚ด๋ถ€์ ์œผ๋กœ๋Š” Effect๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ๋„ ์š”์ฒญ ์ค‘๋ณต ์ œ๊ฑฐ, ์‘๋‹ต ์บ์‹ฑ, ๋„คํŠธ์›Œํฌ ํญํฌ ๋ฐฉ์ง€(๋ฐ์ดํ„ฐ๋ฅผ ๋ฏธ๋ฆฌ ๋กœ๋“œํ•˜๊ฑฐ๋‚˜ ๋ฐ์ดํ„ฐ ์š”๊ตฌ ์‚ฌํ•ญ์„ ๋ผ์šฐํŠธ๋กœ ๋Œ์–ด์˜ฌ๋ฆฌ๋Š” ๋ฐฉ์‹)๋ฅผ ์œ„ํ•œ ๋กœ์ง์„ ์ถ”๊ฐ€ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
10551055
10561056
๋งŒ์•ฝ ์ด๋Ÿฌํ•œ ์ ‘๊ทผ ๋ฐฉ์‹์ด ์ ํ•ฉํ•˜์ง€ ์•Š๋‹ค๋ฉด Effect ๋‚ด๋ถ€์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ํŽ˜์นญํ•˜๋Š” ๊ฒƒ์„ ๊ณ„์† ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
10571057
@@ -1691,7 +1691,7 @@ button { margin-left: 10px; }
16911691
16921692
### Effect์—์„œ ์ตœ์‹  props์™€ state๋ฅผ ์ฝ๊ธฐ {/*reading-the-latest-props-and-state-from-an-effect*/}
16931693
1694-
By default, when you read a reactive value from an Effect, you have to add it as a dependency. This ensures that your Effect "reacts" to every change of that value. For most dependencies, that's the behavior you want.
1694+
๊ธฐ๋ณธ์ ์œผ๋กœ Effect์—์„œ ๋ฐ˜์‘ํ˜• ๊ฐ’์„ ์ฝ์„ ๋•Œ๋Š” ํ•ด๋‹น ๊ฐ’์„ ์˜์กด์„ฑ์œผ๋กœ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด Effect๊ฐ€ ๊ทธ ๊ฐ’์˜ ๋ชจ๋“  ๋ณ€๊ฒฝ์— '๋ฐ˜์‘'ํ•˜๋„๋ก ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ์˜์กด์„ฑ์—์„œ๋Š” ์ด๊ฒƒ์ด ์›ํ•˜๋Š” ๋™์ž‘์ž…๋‹ˆ๋‹ค.
16951695
16961696
**๊ทธ๋Ÿฌ๋‚˜ ๋•Œ๋กœ๋Š” Effect์—์„œ ์ตœ์‹  props์™€ state๋ฅผ '๋ฐ˜์‘'ํ•˜์ง€ ์•Š๊ณ  ์ฝ๊ณ  ์‹ถ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.** ์˜ˆ๋ฅผ ๋“ค์–ด ํŽ˜์ด์ง€ ๋ฐฉ๋ฌธ๋งˆ๋‹ค ์‡ผํ•‘ ์นดํŠธ์— ๋‹ด๊ธด ํ•ญ๋ชฉ ์ˆ˜๋ฅผ ๊ธฐ๋กํ•˜๊ณ  ์‹ถ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
16971697
@@ -1704,7 +1704,7 @@ function Page({ url, shoppingCart }) {
17041704
}
17051705
```
17061706
1707-
**What if you want to log a new page visit after every `url` change, but *not* if only the `shoppingCart` changes?** You can't exclude `shoppingCart` from dependencies without breaking the [reactivity rules.](#specifying-reactive-dependencies) However, you can express that you *don't want* a piece of code to "react" to changes even though it is called from inside an Effect. [Declare an *Effect Event*](/learn/separating-events-from-effects#declaring-an-effect-event) with the [`useEffectEvent`](/reference/react/useEffectEvent) Hook, and move the code reading `shoppingCart` inside of it:
1707+
**`url`์ด ๋ณ€๊ฒฝ๋  ๋•Œ๋งˆ๋‹ค ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€ ๋ฐฉ๋ฌธ์„ ๊ธฐ๋กํ•˜๊ณ  ์‹ถ์ง€๋งŒ, `shoppingCart`๋งŒ ๋ณ€๊ฒฝ๋˜์—ˆ์„ ๋•Œ๋Š” ๊ธฐ๋กํ•˜๊ณ  ์‹ถ์ง€ *์•Š๋‹ค๋ฉด* ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ• ๊นŒ์š”?** [๋ฐ˜์‘ํ˜• ๊ทœ์น™](#specifying-reactive-dependencies)์„ ์œ„๋ฐ˜ํ•˜์ง€ ์•Š๊ณ ๋Š” `shoppingCart`๋ฅผ ์˜์กด์„ฑ์—์„œ ์ œ์™ธํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์–ด๋–ค ์ฝ”๋“œ๊ฐ€ Effect ๋‚ด๋ถ€์—์„œ ํ˜ธ์ถœ๋˜๋”๋ผ๋„ ๊ทธ ์ฝ”๋“œ๊ฐ€ ๋ณ€๊ฒฝ์— '๋ฐ˜์‘'ํ•˜๊ธฐ๋ฅผ *์›ํ•˜์ง€ ์•Š๋Š”๋‹ค๊ณ * ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. [`useEffectEvent`](/reference/react/useEffectEvent) Hook์œผ๋กœ [*Effect ์ด๋ฒคํŠธ*๋ฅผ ์„ ์–ธ](/learn/separating-events-from-effects#declaring-an-effect-event)ํ•˜๊ณ , `shoppingCart`๋ฅผ ์ฝ๋Š” ์ฝ”๋“œ๋ฅผ ๊ทธ ์•ˆ์œผ๋กœ ์˜ฎ๊ธฐ์„ธ์š”.
17081708
17091709
```js {2-4,7,8}
17101710
function Page({ url, shoppingCart }) {
@@ -1728,7 +1728,7 @@ function Page({ url, shoppingCart }) {
17281728
17291729
### ์„œ๋ฒ„์™€ ํด๋ผ์ด์–ธํŠธ์—์„œ ๋‹ค๋ฅธ ์ปจํ…์ธ ๋ฅผ ํ‘œ์‹œํ•˜๊ธฐ {/*displaying-different-content-on-the-server-and-the-client*/}
17301730
1731-
If your app uses server rendering (either [directly](/reference/react-dom/server) or via a [framework](/learn/start-a-new-react-project#full-stack-frameworks)), your component will render in two different environments. On the server, it will render to produce the initial HTML. On the client, React will run the rendering code again so that it can attach your event handlers to that HTML. This is why, for [hydration](/reference/react-dom/client/hydrateRoot#hydrating-server-rendered-html) to work, your initial render output must be identical on the client and the server.
1731+
์•ฑ์ด ([์ง์ ‘](/reference/react-dom/server) ํ˜น์€ [ํ”„๋ ˆ์ž„์›Œํฌ](/learn/start-a-new-react-project#full-stack-frameworks)๋ฅผ ํ†ตํ•ด) ์„œ๋ฒ„ ๋ Œ๋”๋ง์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ, ์ปดํฌ๋„ŒํŠธ๋Š” ๋‘ ๊ฐ€์ง€ ์„œ๋กœ ๋‹ค๋ฅธ ํ™˜๊ฒฝ์—์„œ ๋ Œ๋”๋ง๋ฉ๋‹ˆ๋‹ค. ์„œ๋ฒ„์—์„œ๋Š” ์ดˆ๊ธฐ HTML์„ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด ๋ Œ๋”๋ง๋ฉ๋‹ˆ๋‹ค. ํด๋ผ์ด์–ธํŠธ์—์„œ๋Š” React๊ฐ€ ๋ Œ๋”๋ง ์ฝ”๋“œ๋ฅผ ๋‹ค์‹œ ์‹คํ–‰ํ•˜์—ฌ ํ•ด๋‹น HTML์— ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๋ฅผ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ด์œ ๋กœ [hydration](/reference/react-dom/client/hydrateRoot#hydrating-server-rendered-html)์ด ๋™์ž‘ํ•˜๋ ค๋ฉด ์ดˆ๊ธฐ ๋ Œ๋”๋ง ๊ฒฐ๊ณผ๋ฌผ์ด ํด๋ผ์ด์–ธํŠธ์™€ ์„œ๋ฒ„์—์„œ ๋™์ผํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
17321732
17331733
๋“œ๋ฌผ๊ฒŒ ํด๋ผ์ด์–ธํŠธ์—์„œ ๋‹ค๋ฅธ ๋‚ด์šฉ์„ ํ‘œ์‹œํ•ด์•ผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์•ฑ์ด [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)์—์„œ ์ผ๋ถ€ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ๋Š” ๊ฒฝ์šฐ, ์ด๋ฅผ ์„œ๋ฒ„์—์„œ ๊ตฌํ˜„ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ์ด๊ฒƒ์„ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.
17341734

0 commit comments

Comments
ย (0)