Skip to content

Commit 5f58ba6

Browse files
authored
Merge branch 'main' into glossary-update
2 parents fff5b79 + 7a88505 commit 5f58ba6

File tree

17 files changed

+306
-306
lines changed

17 files changed

+306
-306
lines changed

src/content/learn/react-compiler/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ React 컴파일러는 [React의 규칙](/reference/rules)을 따르는 코드를
2020

2121
### 컴파일러 오류 vs 런타임 문제 {/*compiler-errors-vs-runtime-issues*/}
2222

23-
**컴파일러 오류**는 빌드 시점에 발생하며 코드가 컴파일되지 않게 합니다. 컴파일러는 문제가 있는 코드를 실패시키기보다 건너뛰도록 설계되어 있기 때문에 이러한 오류는 드뭅니다.
23+
**컴파일러 오류**는 빌드 시점에 발생하며 코드가 컴파일되지 않게 합니다. 컴파일러는 문제가 있는 코드를 실패시키기보다 건너뛰도록 설계되어 있기 때문에 이러한 오류는 자주 발생하지 않습니다.
2424

2525
**런타임 문제**는 컴파일된 코드가 예상과 다르게 동작할 때 발생합니다. React 컴파일러 관련 문제가 발생하면 대부분 런타임 문제입니다. 이는 일반적으로 컴파일러가 감지할 수 없는 미묘한 방식으로 코드가 React의 규칙을 위반하고, 컴파일러가 건너뛰어야 했던 컴포넌트를 실수로 컴파일했을 때 발생합니다.
2626

src/content/learn/react-compiler/incremental-adoption.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ title: 점진적 도입
33
---
44

55
<Intro>
6-
React 컴파일러는 점진적으로 도입할 수 있어서 코드베이스의 특정 부분에서 먼저 시도해 볼 수 있습니다. 이 가이드에서는 기존 프로젝트에서 컴파일러를 단계적으로 배포하는 방법을 알아봅니다.
6+
React 컴파일러는 점진적으로 도입할 수 있으며, 코드베이스의 특정 부분에서 먼저 시도해 볼 수 있습니다. 이 가이드에서는 기존 프로젝트에서 컴파일러를 단계적으로 배포하는 방법을 알아봅니다.
77
</Intro>
88

99
<YouWillLearn>
1010

1111
* 점진적 도입이 권장되는 이유
1212
* 디렉터리 기반 도입을 위한 Babel overrides 사용
13-
* 선택적 컴파일을 위한 "use memo" 지시어 사용
14-
* 컴포넌트 제외를 위한 "use no memo" 지시어 사용
13+
* 선택적 컴파일을 위한 `"use memo"` 지시어 사용
14+
* 컴포넌트 제외를 위한 `"use no memo"` 지시어 사용
1515
* 게이팅을 통한 런타임 기능 플래그
1616
* 도입 진행 상황 모니터링
1717

@@ -32,7 +32,7 @@ React 컴파일러는 전체 코드베이스를 자동으로 최적화하도록
3232
React 컴파일러를 점진적으로 도입하는 세 가지 주요 방법이 있습니다.
3333

3434
1. **Babel overrides** - 특정 디렉터리에 컴파일러 적용
35-
2. **"use memo"로 선택적 적용** - 명시적으로 선택한 컴포넌트만 컴파일
35+
2. **`"use memo"`로 선택적 적용** - 명시적으로 선택한 컴포넌트만 컴파일
3636
3. **런타임 게이팅** - 기능 플래그로 컴파일 제어
3737

3838
모든 방법은 전체 배포 전에 애플리케이션의 특정 부분에서 컴파일러를 테스트할 수 있게 해줍니다.
@@ -119,9 +119,9 @@ module.exports = {
119119
```
120120

121121

122-
## "use memo"를 사용한 선택적 모드 {/*opt-in-mode-with-use-memo*/}
122+
## `"use memo"`를 사용한 선택적 모드 {/*opt-in-mode-with-use-memo*/}
123123

124-
최대한의 제어를 위해 `compilationMode: 'annotation'`을 사용하여 `"use memo"` 지시어로 명시적으로 선택한 컴포넌트와 Hook만 컴파일할 수 있습니다.
124+
최대한의 제어를 위해 `compilationMode: 'annotation'`을 사용하여 `"use memo"` 지시어를 통해 명시적으로 선택한 컴포넌트와 Hook만 컴파일할 수 있습니다.
125125

126126
<Note>
127127
이 방법은 개별 컴포넌트와 Hook에 대한 세밀한 제어를 제공합니다. 전체 디렉터리에 영향을 주지 않고 특정 컴포넌트에서 컴파일러를 테스트하고 싶을 때 유용합니다.
@@ -167,9 +167,9 @@ function useSortedData(data) {
167167
```
168168

169169
`compilationMode: 'annotation'`을 사용하면 다음을 해야 합니다.
170-
- 최적화하려는 모든 컴포넌트에 `"use memo"` 추가
171-
- 모든 커스텀 Hook에 `"use memo"` 추가
172-
- 컴포넌트에도 추가하는 것을 기억
170+
- 최적화하려는 모든 컴포넌트에 `"use memo"`를 추가합니다.
171+
- 모든 커스텀 Hook에 `"use memo"`를 추가합니다.
172+
- 이후에 새로 작성하는 컴포넌트에도 추가하는 것을 잊지 마세요.
173173

174174
이를 통해 컴파일러의 영향을 평가하는 동안 어떤 컴포넌트가 컴파일되는지 정밀하게 제어할 수 있습니다.
175175

src/content/learn/react-compiler/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ title: React 컴파일러
88

99
## 설치 {/*installation*/}
1010

11-
[React 컴파일러 설치](/learn/react-compiler/installation)를 시작하고 빌드 도구와 함께 구성하는 방법을 알아보세요.
11+
[React 컴파일러 설치](/learn/react-compiler/installation)통해 시작하고 빌드 도구와 함께 구성하는 방법을 알아보세요.
1212

1313

1414
## 점진적 도입 {/*incremental-adoption*/}

src/content/learn/react-compiler/installation.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ ESLint 규칙은 다음과 같은 역할을 합니다.
187187

188188
React 컴파일러에 의해 최적화된 컴포넌트는 React DevTools에서 "Memo ✨" 배지가 표시됩니다.
189189

190-
1. [React Developer Tools](/learn/react-developer-tools) 브라우저 확장 프로그램을 설치합니다
191-
2. 개발 모드에서 앱을 엽니다
192-
3. React DevTools를 엽니다
193-
4. 컴포넌트 이름 옆에 ✨ 이모지가 있는지 확인합니다
190+
1. [React Developer Tools](/learn/react-developer-tools) 브라우저 확장 프로그램을 설치합니다.
191+
2. 개발 모드에서 앱을 엽니다.
192+
3. React DevTools를 엽니다.
193+
4. 컴포넌트 이름 옆에 ✨ 이모지가 있는지 확인합니다.
194194

195195
컴파일러가 작동하는 경우
196-
- 컴포넌트에 "Memo ✨" 배지가 React DevTools에 표시됩니다
197-
- 비용이 큰 계산이 자동으로 메모이제이션됩니다
198-
- 수동으로 `useMemo`를 사용할 필요가 없습니다
196+
- 컴포넌트에 "Memo ✨" 배지가 React DevTools에 표시됩니다.
197+
- 비용이 큰 계산이 자동으로 메모이제이션됩니다.
198+
- 수동으로 `useMemo`를 사용할 필요가 없습니다.
199199

200200
### 빌드 출력 확인 {/*check-build-output*/}
201201

src/content/learn/react-compiler/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ React 컴파일러의 자동 메모이제이션은 주로 **업데이트 성능
9999

100100
#### 리렌더링 최적화 {/*optimizing-re-renders*/}
101101

102-
React는 UI를 현재 state의 함수로 표현할 수 있게 해줍니다 (더 구체적으로는 props, state, context). 현재 구현에서 컴포넌트의 state가 변경되면 React는 `useMemo()`, `useCallback()`, `React.memo()`를 사용한 수동 메모이제이션을 적용하지 않는 한 해당 컴포넌트 _ 모든 자식 컴포넌트_를 리렌더링합니다. 예를 들어, 다음 예시에서 `<MessageButton>``<FriendList>`의 state가 변경될 때마다 리렌더링됩니다.
102+
React는 UI를 현재 state의 함수로 표현할 수 있게 해줍니다 (더 구체적으로는 props, state, context). 현재 구현에서 컴포넌트의 state가 변경되면 React는 `useMemo()`, `useCallback()`, `React.memo()`를 사용한 수동 메모이제이션을 적용하지 않는 한 해당 컴포넌트 <em>및 모든 자식 컴포넌트</em>를 리렌더링합니다. 예를 들어, 다음 예시에서 `<MessageButton>``<FriendList>`의 state가 변경될 때마다 리렌더링됩니다.
103103

104104
```javascript
105105
function FriendList({ friends }) {
@@ -144,7 +144,7 @@ function TableContainer({ items }) {
144144
- React 컴파일러는 모든 함수가 아닌 React 컴포넌트와 Hook만 메모이제이션합니다.
145145
- React 컴파일러의 메모이제이션은 여러 컴포넌트나 Hook 간에 공유되지 않습니다.
146146

147-
따라서 `expensivelyProcessAReallyLargeArrayOfObjects`가 여러 다른 컴포넌트에서 사용되는 경우, 정확히 동일한 items가 전달되더라도 비용이 많이 드는 계산이 반복적으로 실행됩니다. 코드를 더 복잡하게 만들기 전에 먼저 [프로파일링](reference/react/useMemo#how-to-tell-if-a-calculation-is-expensive)하여 정말로 비용이 많이 드는지 확인하는 것을 권장합니다.
147+
따라서 `expensivelyProcessAReallyLargeArrayOfObjects`가 여러 다른 컴포넌트에서 사용되는 경우, 정확히 동일한 `items` 전달되더라도 비용이 많이 드는 계산이 반복적으로 실행됩니다. 코드를 더 복잡하게 만들기 전에 먼저 [프로파일링](reference/react/useMemo#how-to-tell-if-a-calculation-is-expensive)하여 정말로 비용이 많이 드는지 확인하는 것을 권장합니다.
148148
</DeepDive>
149149

150150
## 컴파일러를 사용해 봐야 하나요? {/*should-i-try-out-the-compiler*/}

src/content/reference/react-compiler/compilationMode.md

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: compilationMode
44

55
<Intro>
66

7-
The `compilationMode` option controls how the React Compiler selects which functions to compile.
7+
`compilationMode` 옵션은 React 컴파일러가 어떤 함수를 컴파일할지 선택하는 방식을 제어합니다.
88

99
</Intro>
1010

@@ -18,95 +18,95 @@ The `compilationMode` option controls how the React Compiler selects which funct
1818

1919
---
2020

21-
## Reference {/*reference*/}
21+
## 레퍼런스 {/*reference*/}
2222

2323
### `compilationMode` {/*compilationmode*/}
2424

25-
Controls the strategy for determining which functions the React Compiler will optimize.
25+
React 컴파일러가 최적화할 함수를 결정하는 전략을 제어합니다.
2626

27-
#### Type {/*type*/}
27+
#### 타입 {/*type*/}
2828

2929
```
3030
'infer' | 'syntax' | 'annotation' | 'all'
3131
```
3232

33-
#### Default value {/*default-value*/}
33+
#### 기본값 {/*default-value*/}
3434

3535
`'infer'`
3636

37-
#### Options {/*options*/}
37+
#### 옵션 {/*options*/}
3838

39-
- **`'infer'`** (default): The compiler uses intelligent heuristics to identify React components and hooks:
40-
- Functions explicitly annotated with `"use memo"` directive
41-
- Functions that are named like components (PascalCase) or hooks (`use` prefix) AND create JSX and/or call other hooks
39+
- **`'infer'`** (기본값): 컴파일러가 지능형 휴리스틱을 사용하여 React 컴포넌트와 Hook을 식별합니다.
40+
- `"use memo"` 지시어로 명시적으로 표시된 함수.
41+
- 컴포넌트(PascalCase) 또는 Hook(`use` 접두사)처럼 이름이 지어진 함수이면서 JSX를 생성하거나 다른 Hook을 호출하는 함수.
4242

43-
- **`'annotation'`**: Only compile functions explicitly marked with the `"use memo"` directive. Ideal for incremental adoption.
43+
- **`'annotation'`**: `"use memo"` 지시어로 명시적으로 표시된 함수만 컴파일합니다. 점진적 도입에 이상적입니다.
4444

45-
- **`'syntax'`**: Only compile components and hooks that use Flow's [component](https://flow.org/en/docs/react/component-syntax/) and [hook](https://flow.org/en/docs/react/hook-syntax/) syntax.
45+
- **`'syntax'`**: Flow의 [Component](https://flow.org/en/docs/react/component-syntax/) [Hook](https://flow.org/en/docs/react/hook-syntax/) 문법을 사용하는 컴포넌트와 Hook만 컴파일합니다.
4646

47-
- **`'all'`**: Compile all top-level functions. Not recommended as it may compile non-React functions.
47+
- **`'all'`**: 모든 최상위 함수를 컴파일합니다. React가 아닌 함수도 컴파일할 수 있으므로 권장하지 않습니다.
4848

49-
#### Caveats {/*caveats*/}
49+
#### 주의 사항 {/*caveats*/}
5050

51-
- The `'infer'` mode requires functions to follow React naming conventions to be detected
52-
- Using `'all'` mode may negatively impact performance by compiling utility functions
53-
- The `'syntax'` mode requires Flow and won't work with TypeScript
54-
- Regardless of mode, functions with `"use no memo"` directive are always skipped
51+
- `'infer'` 모드는 함수가 React 명명 규칙을 따라야 감지할 수 있습니다.
52+
- `'all'` 모드를 사용하면 유틸리티 함수까지 컴파일하여 성능에 부정적인 영향을 미칠 수 있습니다.
53+
- `'syntax'` 모드는 Flow가 필요하며 TypeScript와는 작동하지 않습니다.
54+
- 모드와 관계없이 `"use no memo"` 지시어가 있는 함수는 항상 건너뜁니다.
5555

5656
---
5757

58-
## Usage {/*usage*/}
58+
## 사용법 {/*usage*/}
5959

60-
### Default inference mode {/*default-inference-mode*/}
60+
### 기본 추론 모드 {/*default-inference-mode*/}
6161

62-
The default `'infer'` mode works well for most codebases that follow React conventions:
62+
기본 `'infer'` 모드는 React의 규칙을 따르는 대부분의 코드베이스에서 잘 작동합니다.
6363

6464
```js
6565
{
6666
compilationMode: 'infer'
6767
}
6868
```
6969

70-
With this mode, these functions will be compiled:
70+
이 모드에서는 다음 함수들이 컴파일됩니다.
7171

7272
```js
73-
//Compiled: Named like a component + returns JSX
73+
//컴파일됨: 컴포넌트처럼 이름이 지어졌고 JSX를 반환함
7474
function Button(props) {
7575
return <button>{props.label}</button>;
7676
}
7777

78-
//Compiled: Named like a hook + calls hooks
78+
//컴파일됨: Hook처럼 이름이 지어졌고 Hook을 호출함
7979
function useCounter() {
8080
const [count, setCount] = useState(0);
8181
return [count, setCount];
8282
}
8383

84-
//Compiled: Explicit directive
84+
//컴파일됨: 명시적인 지시어
8585
function expensiveCalculation(data) {
8686
"use memo";
8787
return data.reduce(/* ... */);
8888
}
8989

90-
//Not compiled: Not a component/hook pattern
90+
//컴파일되지 않음: 컴포넌트/Hook 패턴이 아님
9191
function calculateTotal(items) {
9292
return items.reduce((a, b) => a + b, 0);
9393
}
9494
```
9595

96-
### Incremental adoption with annotation mode {/*incremental-adoption*/}
96+
### 어노테이션 모드를 사용한 점진적 도입 {/*incremental-adoption*/}
9797

98-
For gradual migration, use `'annotation'` mode to only compile marked functions:
98+
점진적 마이그레이션을 위해 `'annotation'` 모드를 사용하여 표시된 함수만 컴파일합니다.
9999

100100
```js
101101
{
102102
compilationMode: 'annotation'
103103
}
104104
```
105105

106-
Then explicitly mark functions to compile:
106+
그런 다음 컴파일할 함수를 명시적으로 표시합니다.
107107

108108
```js
109-
// Only this function will be compiled
109+
// 이 함수만 컴파일됩니다
110110
function ExpensiveList(props) {
111111
"use memo";
112112
return (
@@ -118,51 +118,51 @@ function ExpensiveList(props) {
118118
);
119119
}
120120

121-
// This won't be compiled without the directive
121+
// 지시어가 없으면 컴파일되지 않습니다
122122
function NormalComponent(props) {
123123
return <div>{props.content}</div>;
124124
}
125125
```
126126

127-
### Using Flow syntax mode {/*flow-syntax-mode*/}
127+
### Flow 문법 모드 사용하기 {/*flow-syntax-mode*/}
128128

129-
If your codebase uses Flow instead of TypeScript:
129+
코드베이스가 TypeScript 대신 Flow를 사용하는 경우입니다.
130130

131131
```js
132132
{
133133
compilationMode: 'syntax'
134134
}
135135
```
136136

137-
Then use Flow's component syntax:
137+
그런 다음 Flow의 컴포넌트 문법을 사용합니다.
138138

139139
```js
140-
// Compiled: Flow component syntax
140+
// 컴파일됨: Flow 컴포넌트 문법
141141
component Button(label: string) {
142142
return <button>{label}</button>;
143143
}
144144

145-
// Compiled: Flow hook syntax
145+
// 컴파일됨: Flow Hook 문법
146146
hook useCounter(initial: number) {
147147
const [count, setCount] = useState(initial);
148148
return [count, setCount];
149149
}
150150

151-
// Not compiled: Regular function syntax
151+
// 컴파일되지 않음: 일반 함수 문법
152152
function helper(data) {
153153
return process(data);
154154
}
155155
```
156156

157-
### Opting out specific functions {/*opting-out*/}
157+
### 특정 함수 제외하기 {/*opting-out*/}
158158

159-
Regardless of compilation mode, use `"use no memo"` to skip compilation:
159+
컴파일 모드와 관계없이 `"use no memo"`를 사용하여 컴파일을 건너뛸 수 있습니다.
160160

161161
```js
162162
function ComponentWithSideEffects() {
163-
"use no memo"; // Prevent compilation
163+
"use no memo"; // 컴파일 방지
164164

165-
// This component has side effects that shouldn't be memoized
165+
// 이 컴포넌트는 메모이제이션되어서는 안 되는 사이드 이펙트가 있습니다
166166
logToAnalytics('component_rendered');
167167

168168
return <div>Content</div>;
@@ -171,29 +171,29 @@ function ComponentWithSideEffects() {
171171

172172
---
173173

174-
## Troubleshooting {/*troubleshooting*/}
174+
## 문제 해결 {/*troubleshooting*/}
175175

176-
### Component not being compiled in infer mode {/*component-not-compiled-infer*/}
176+
### `'infer'` 모드에서 컴포넌트가 컴파일되지 않는 경우 {/*component-not-compiled-infer*/}
177177

178-
In `'infer'` mode, ensure your component follows React conventions:
178+
`'infer'` 모드에서는 컴포넌트가 React의 규칙을 따르는지 확인하세요.
179179

180180
```js
181-
//Won't be compiled: lowercase name
181+
//컴파일되지 않음: 소문자 이름
182182
function button(props) {
183183
return <button>{props.label}</button>;
184184
}
185185

186-
//Will be compiled: PascalCase name
186+
//컴파일됨: PascalCase 이름
187187
function Button(props) {
188188
return <button>{props.label}</button>;
189189
}
190190

191-
//Won't be compiled: doesn't create JSX or call hooks
191+
//컴파일되지 않음: JSX를 생성하거나 Hook을 호출하지 않음
192192
function useData() {
193193
return window.localStorage.getItem('data');
194194
}
195195

196-
//Will be compiled: calls a hook
196+
//컴파일됨: Hook을 호출함
197197
function useData() {
198198
const [data] = useState(() => window.localStorage.getItem('data'));
199199
return data;

0 commit comments

Comments
 (0)