Skip to content

Commit 57c61f8

Browse files
authored
docs: update scailing-up-with-reducer-and-context.md (#1090)
1 parent 1af5d7f commit 57c61f8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/content/learn/scaling-up-with-reducer-and-context.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Reducer를 사용하면 컴포넌트의 state 업데이트 로직을 통합할
1818

1919
## Reducer와 context를 결합하기 {/*combining-a-reducer-with-context*/}
2020

21-
[Reducer의 개요](/learn/extracting-state-logic-into-a-reducer)의 예시에서 reducer로 state를 관리하는 방법을 알아보았습니다. 해당 예시에서 state 업데이트 로직을 모두 포함하는 reducer 함수를 App.js 파일의 맨 아래에 선언했습니다.
21+
[Reducer의 개요](/learn/extracting-state-logic-into-a-reducer)의 예시에서 reducer로 state를 관리하는 방법을 알아보았습니다. 해당 예시에서 state 업데이트 로직을 모두 포함하는 reducer 함수를 `App.js` 파일의 맨 아래에 선언했습니다.
2222

2323
<Sandpack>
2424

@@ -209,7 +209,7 @@ ul, li { margin: 0; padding: 0; }
209209

210210
Reducer는 이벤트 핸들러를 짧고 간결하게 유지하는 데 도움이 됩니다. 그러나 앱이 커지면 다른 어려움에 부딪힐지도 모릅니다. **현재 `tasks` state 및 `dispatch` 함수는 최상위 `TaskApp` 컴포넌트에서만 사용할 수 있습니다.** 다른 컴포넌트가 작업 목록을 읽거나 변경하려면 현재 state와 해당 state를 변경하는 이벤트 핸들러를 명시적으로 [props로 전달](/learn/passing-props-to-a-component)해야 합니다.
211211

212-
예를 들어, `TaskApp`은 tasks 리스트와 이벤트 핸들러를 `TaskList`에 전달합니다.
212+
예를 들어, `TaskApp``tasks` 리스트와 이벤트 핸들러를 `TaskList`에 전달합니다.
213213

214214
```js
215215
<TaskList
@@ -235,9 +235,9 @@ Reducer는 이벤트 핸들러를 짧고 간결하게 유지하는 데 도움이
235235

236236
Reducer와 context를 결합하는 방법은 아래와 같습니다.
237237

238-
1. Context를 **생성한다**.
239-
2. State과 dispatch 함수를 context에 **넣는다**.
240-
3. 트리 안에서 context를 **사용한다**.
238+
1. Context를 **생성합니다**.
239+
2. State와 dispatch 함수를 context에 **넣습니다**.
240+
3. 트리 안에서 context를 **사용합니다**.
241241

242242
### 1단계: Context 생성 {/*step-1-create-the-context*/}
243243

@@ -249,7 +249,7 @@ const [tasks, dispatch] = useReducer(tasksReducer, initialTasks);
249249

250250
트리를 통해 전달하려면, 두 개의 별개의 context를 [생성](/learn/passing-data-deeply-with-context#step-2-use-the-context)해야 합니다.
251251

252-
- `TasksContext`는 현재 tasks 리스트를 제공합니다.
252+
- `TasksContext`는 현재 `tasks` 리스트를 제공합니다.
253253
- `TasksDispatchContext`는 컴포넌트에서 action을 dispatch 하는 함수를 제공합니다.
254254

255255
두 context는 나중에 다른 파일에서 가져올 수 있도록 별도의 파일에서 내보냅니다.
@@ -673,7 +673,7 @@ ul, li { margin: 0; padding: 0; }
673673

674674
### 3단계: 트리 안에서 context 사용하기 {/*step-3-use-context-anywhere-in-the-tree*/}
675675

676-
이제 tasks 리스트나 이벤트 핸들러를 트리 아래로 전달할 필요가 없습니다.
676+
이제 `tasks` 리스트나 이벤트 핸들러를 트리 아래로 전달할 필요가 없습니다.
677677

678678
```js {4-5}
679679
<TasksContext.Provider value={tasks}>
@@ -685,15 +685,15 @@ ul, li { margin: 0; padding: 0; }
685685
</TasksContext.Provider>
686686
```
687687

688-
대신 필요한 컴포넌트에서는 `TaskContext`에서 tasks 리스트를 읽을 수 있습니다.
688+
대신 필요한 컴포넌트에서는 `TaskContext`에서 `tasks` 리스트를 읽을 수 있습니다.
689689

690690
```js {2}
691691
export default function TaskList() {
692692
const tasks = useContext(TasksContext);
693693
// ...
694694
```
695695
696-
tasks 리스트를 업데이트하기 위해서 컴포넌트에서 context의 `dispatch` 함수를 읽고 호출할 수 있습니다.
696+
`tasks` 리스트를 업데이트하기 위해서 컴포넌트에서 context의 `dispatch` 함수를 읽고 호출할 수 있습니다.
697697
698698
```js {3,9-13}
699699
export default function AddTask({ onAddTask }) {

0 commit comments

Comments
 (0)