Skip to content

Commit 5a99327

Browse files
committed
docs: translate React Compiler Section
1 parent 9123887 commit 5a99327

File tree

2 files changed

+51
-51
lines changed

2 files changed

+51
-51
lines changed

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;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ title: 설정
1010

1111
<Note>
1212

13-
대부분의 앱에서는 기본 옵션이 기본적으로 잘 작동합니다. 특별한 필요가 있다면 이러한 고급 옵션을 사용할 수 있습니다.
13+
대부분의 앱에서는 기본 옵션이 기본적으로 잘 작동합니다. 특별한 필요성이 있는 경우에 이러한 고급 옵션을 사용할 수 있습니다.
1414

1515
</Note>
1616

@@ -31,9 +31,9 @@ module.exports = {
3131

3232
## 컴파일 제어 {/*compilation-control*/}
3333

34-
이 옵션들은 컴파일러가 *무엇*을 최적화하고, *어떻게* 컴포넌트와 hooks를 컴파일 대상으로 선택할지를 제어합니다.
34+
이 옵션들은 컴파일러가 *무엇*을 최적화하고, *어떻게* 컴포넌트와 Hook을 컴파일 대상으로 선택할지를 제어합니다.
3535

36-
* [`compilationMode`](/reference/react-compiler/compilationMode)는 컴파일할 함수를 선택하는 전략을 제어합니다. (예: 모든 함수, 어노테이션된 함수만, 또는 컴파일러의 자동 감지).
36+
* [`compilationMode`](/reference/react-compiler/compilationMode)는 컴파일할 함수를 선택하는 전략을 제어합니다. (예: 모든 함수, 어노테이션된 함수만, 또는 컴파일러의 자동 감지)
3737

3838
```js
3939
{
@@ -127,7 +127,7 @@ module.exports = {
127127

128128
### React 17/18 프로젝트 {/*react-17-18*/}
129129

130-
React 17/18 프로젝트에서는 런타임 패키지와 target 설정이 필요합니다.
130+
React 17/18 프로젝트에서는 런타임 패키지와 `target` 설정이 필요합니다.
131131

132132
```bash
133133
npm install react-compiler-runtime@latest

0 commit comments

Comments
 (0)