Skip to content

Commit 30be3c3

Browse files
docs: translate React Complier Directives.md (#1422)
Closes: #1395 # React Complier Directives 번역 - [React Complier Directives](https://ko.react.dev/reference/react-compiler/directives) 페이지를 번역했습니다. ## 필수 확인 사항 - [x] [기여자 행동 강령 규약<sup>Code of Conduct</sup>](https://github.com/reactjs/ko.react.dev/blob/main/CODE_OF_CONDUCT.md) - [x] [기여 가이드라인<sup>Contributing</sup>](https://github.com/reactjs/ko.react.dev/blob/main/CONTRIBUTING.md) - [x] [공통 스타일 가이드<sup>Universal Style Guide</sup>](https://github.com/reactjs/ko.react.dev/blob/main/wiki/universal-style-guide.md) - [x] [번역을 위한 모범 사례<sup>Best Practices for Translation</sup>](https://github.com/reactjs/ko.react.dev/blob/main/wiki/best-practices-for-translation.md) - [x] [번역 용어 정리<sup>Translate Glossary</sup>](https://github.com/reactjs/ko.react.dev/blob/main/wiki/translate-glossary.md) - [x] [`textlint` 가이드<sup>Textlint Guide</sup>](https://github.com/reactjs/ko.react.dev/blob/main/wiki/textlint-guide.md) - [x] [맞춤법 검사<sup>Spelling Check</sup>](https://nara-speller.co.kr/speller/) ## 선택 확인 사항 - [ ] 번역 초안 작성<sup>Draft Translation</sup> - [ ] 리뷰 반영<sup>Resolve Reviews</sup> --------- Co-authored-by: 루밀LuMir <rpfos@naver.com>
1 parent 5e18d23 commit 30be3c3

File tree

2 files changed

+68
-68
lines changed

2 files changed

+68
-68
lines changed
Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: Directives
2+
title: 지시어
33
---
44

55
<Intro>
6-
React Compiler directives are special string literals that control whether specific functions are compiled.
6+
React 컴파일러 지시어는 특정 함수에 대한 컴파일 적용 여부를 제어하는 특수 문자열 리터럴입니다.
77
</Intro>
88

99
```js
1010
function MyComponent() {
11-
"use memo"; // Opt this component into compilation
11+
"use memo"; // 이 컴포넌트를 컴파일 대상으로 설정합니다
1212
return <div>{/* ... */}</div>;
1313
}
1414
```
@@ -17,53 +17,53 @@ function MyComponent() {
1717

1818
---
1919

20-
## Overview {/*overview*/}
20+
## 개요 {/*overview*/}
2121

22-
React Compiler directives provide fine-grained control over which functions are optimized by the compiler. They are string literals placed at the beginning of a function body or at the top of a module.
22+
React 컴파일러 지시어는 컴파일러가 최적화할 함수를 세밀하게 제어할 수 있도록 합니다. 함수 본문의 시작 부분이나 모듈의 최상단에 배치되는 문자열 리터럴입니다.
2323

24-
### Available directives {/*available-directives*/}
24+
### 사용 가능한 지시어 {/*available-directives*/}
2525

26-
* **[`"use memo"`](/reference/react-compiler/directives/use-memo)** - Opts a function into compilation
27-
* **[`"use no memo"`](/reference/react-compiler/directives/use-no-memo)** - Opts a function out of compilation
26+
* **[`"use memo"`](/reference/react-compiler/directives/use-memo)** - 함수를 컴파일 대상으로 선택합니다
27+
* **[`"use no memo"`](/reference/react-compiler/directives/use-no-memo)** - 함수를 컴파일 대상에서 제외합니다
2828

29-
### Quick comparison {/*quick-comparison*/}
29+
### 빠른 비교 {/*quick-comparison*/}
3030

31-
| Directive | Purpose | When to use |
31+
| 지시어 | 목적 | 사용 시점 |
3232
|-----------|---------|-------------|
33-
| [`"use memo"`](/reference/react-compiler/directives/use-memo) | Force compilation | When using `annotation` mode or to override `infer` mode heuristics |
34-
| [`"use no memo"`](/reference/react-compiler/directives/use-no-memo) | Prevent compilation | Debugging issues or working with incompatible code |
33+
| [`"use memo"`](/reference/react-compiler/directives/use-memo) | 컴파일 강제 | `annotation` 모드를 사용하거나 `infer` 모드의 휴리스틱을 재정의할 때 |
34+
| [`"use no memo"`](/reference/react-compiler/directives/use-no-memo) | 컴파일 제외 | 이슈를 디버깅하거나 호환되지 않는 코드를 다룰 때 |
3535

3636
---
3737

38-
## Usage {/*usage*/}
38+
## 사용법 {/*usage*/}
3939

40-
### Function-level directives {/*function-level*/}
40+
### 함수 수준 지시어 {/*function-level*/}
4141

42-
Place directives at the beginning of a function to control its compilation:
42+
함수의 시작 부분에 지시어를 선언하여 컴파일을 제어합니다.
4343

4444
```js
45-
// Opt into compilation
45+
// 컴파일 대상으로 설정
4646
function OptimizedComponent() {
4747
"use memo";
4848
return <div>This will be optimized</div>;
4949
}
5050

51-
// Opt out of compilation
51+
// 컴파일 대상에서 제외
5252
function UnoptimizedComponent() {
5353
"use no memo";
5454
return <div>This won't be optimized</div>;
5555
}
5656
```
5757
58-
### Module-level directives {/*module-level*/}
58+
### 모듈 수준 지시어 {/*module-level*/}
5959
60-
Place directives at the top of a file to affect all functions in that module:
60+
파일의 최상단에 선언하여 해당 모듈의 모든 함수에 적용됩니다.
6161
6262
```js
63-
// At the very top of the file
63+
// 파일의 최상단에 선언
6464
"use memo";
6565
66-
// All functions in this file will be compiled
66+
// 이 파일의 모든 함수가 컴파일됩니다
6767
function Component1() {
6868
return <div>Compiled</div>;
6969
}
@@ -72,31 +72,31 @@ function Component2() {
7272
return <div>Also compiled</div>;
7373
}
7474
75-
// Can be overridden at function level
75+
// 함수 수준에서 재정의 가능
7676
function Component3() {
77-
"use no memo"; // This overrides the module directive
77+
"use no memo"; // 모듈 수준에서 재정의됩니다
7878
return <div>Not compiled</div>;
7979
}
8080
```
8181
82-
### Compilation modes interaction {/*compilation-modes*/}
82+
### 컴파일 모드와의 상호작용 {/*compilation-modes*/}
8383
84-
Directives behave differently depending on your [`compilationMode`](/reference/react-compiler/compilationMode):
84+
지시어는 [`compilationMode`](/reference/react-compiler/compilationMode)에 따라 다르게 동작합니다.
8585
86-
* **`annotation` mode**: Only functions with `"use memo"` are compiled
87-
* **`infer` mode**: Compiler decides what to compile, directives override decisions
88-
* **`all` mode**: Everything is compiled, `"use no memo"` can exclude specific functions
86+
* **`annotation` 모드**: `"use memo"`가 선언된 함수만 컴파일됩니다
87+
* **`infer` 모드**: 컴파일러가 컴파일할 대상을 결정하며 지시어는 이 결정을 재정의합니다
88+
* **`all` 모드**: 모든 것이 컴파일되며 `"use no memo"` 로 특정 함수를 제외할 수 있습니다
8989
9090
---
9191
92-
## Best practices {/*best-practices*/}
92+
## 모범 사례 {/*best-practices*/}
9393
94-
### Use directives sparingly {/*use-sparingly*/}
94+
### 지시어는 신중하게 사용하세요 {/*use-sparingly*/}
9595
96-
Directives are escape hatches. Prefer configuring the compiler at the project level:
96+
이 지시어는 탈출구(escape hatch)입니다. 컴파일러는 프로젝트 수준에서 설정하는 것을 권장합니다.
9797
9898
```js
99-
// ✅ Good - project-wide configuration
99+
// ✅ good - 프로젝트 전역 설정
100100
{
101101
plugins: [
102102
['babel-plugin-react-compiler', {
@@ -105,94 +105,94 @@ Directives are escape hatches. Prefer configuring the compiler at the project le
105105
]
106106
}
107107
108-
// ⚠️ Use directives only when needed
108+
// ⚠️ 필요할 때마 지시어 사용
109109
function SpecialCase() {
110-
"use no memo"; // Document why this is needed
110+
"use no memo"; // 왜 필요한지 문서화하세요
111111
// ...
112112
}
113113
```
114114
115-
### Document directive usage {/*document-usage*/}
115+
### 지시어 사용 이유를 문서화하세요 {/*document-usage*/}
116116
117-
Always explain why a directive is used:
117+
지시어를 사용하는 이유를 항상 명확히 설명하세요.
118118
119119
```js
120-
// ✅ Good - clear explanation
120+
// ✅ good - 명확한 설명
121121
function DataGrid() {
122-
"use no memo"; // TODO: Remove after fixing issue with dynamic row heights (JIRA-123)
123-
// Complex grid implementation
122+
"use no memo"; // TODO: 동적 row heiht 이슈 해결 후 제거 (JIRA-123)
123+
// 복잡한 그리드 구현
124124
}
125125
126-
// ❌ Bad - no explanation
126+
// ❌ bad - 설명 없음
127127
function Mystery() {
128128
"use no memo";
129129
// ...
130130
}
131131
```
132132
133-
### Plan for removal {/*plan-removal*/}
133+
### 제거 계획을 세우세요 {/*plan-removal*/}
134134
135-
Opt-out directives should be temporary:
135+
제외 지시어는 임시로 사용해야 합니다.
136136
137-
1. Add the directive with a TODO comment
138-
2. Create a tracking issue
139-
3. Fix the underlying problem
140-
4. Remove the directive
137+
1. TODO 주석과 함께 지시어를 추가합니다
138+
2. 추적용 이슈를 생성합니다
139+
3. 근본적인 문제를 해결합니다
140+
4. 지시어를 제거합니다
141141
142142
```js
143143
function TemporaryWorkaround() {
144-
"use no memo"; // TODO: Remove after upgrading ThirdPartyLib to v2.0
144+
"use no memo"; // TODO: ThirdPartyLib를 v2.0으로 업그레이드한 후 제거
145145
return <ThirdPartyComponent />;
146146
}
147147
```
148148
149149
---
150150
151-
## Common patterns {/*common-patterns*/}
151+
## 일반적인 패턴 {/*common-patterns*/}
152152
153-
### Gradual adoption {/*gradual-adoption*/}
153+
### 점진적 도입 {/*gradual-adoption*/}
154154
155-
When adopting the React Compiler in a large codebase:
155+
대규모 코드베이스에서 React 컴파일러를 도입할 때 다음과 같은 방식이 일반적입니다.
156156
157157
```js
158-
// Start with annotation mode
158+
// annotation 모드로 시작
159159
{
160160
compilationMode: 'annotation'
161161
}
162162
163-
// Opt in stable components
163+
// 안정적인 컴파일러를 컴파일 대상으로 설정
164164
function StableComponent() {
165165
"use memo";
166-
// Well-tested component
166+
// 충분히 테스트된 컴포넌트
167167
}
168168
169-
// Later, switch to infer mode and opt out problematic ones
169+
// 나중에 infer 모드로 전환하고 문제가 있는 컴포넌트는 제외
170170
function ProblematicComponent() {
171-
"use no memo"; // Fix issues before removing
171+
"use no memo"; // 제거 전에 이슈를 해결하세요
172172
// ...
173173
}
174174
```
175175
176176
177177
---
178178
179-
## Troubleshooting {/*troubleshooting*/}
179+
## 문제 해결 {/*troubleshooting*/}
180180
181-
For specific issues with directives, see the troubleshooting sections in:
181+
지시어와 관련된 구체적인 문제는 다음 문제 해결 섹션을 참고하세요.
182182
183-
* [`"use memo"` troubleshooting](/reference/react-compiler/directives/use-memo#troubleshooting)
184-
* [`"use no memo"` troubleshooting](/reference/react-compiler/directives/use-no-memo#troubleshooting)
183+
* [`"use memo"` 문제 해결](/reference/react-compiler/directives/use-memo#troubleshooting)
184+
* [`"use no memo"` 문제 해결](/reference/react-compiler/directives/use-no-memo#troubleshooting)
185185
186-
### Common issues {/*common-issues*/}
186+
### 자주 발생하는 이슈 {/*common-issues*/}
187187
188-
1. **Directive ignored**: Check placement (must be first) and spelling
189-
2. **Compilation still happens**: Check `ignoreUseNoForget` setting
190-
3. **Module directive not working**: Ensure it's before all imports
188+
1. **지시어가 무시됨**: 위치(파일 또는 함수의 첫 줄인지)와 철자를 확인하세요.
189+
2. **컴파일이 계속됨**: `ignoreUseNoForget` 설정을 확인하세요.
190+
3. **모듈 수준 지시어가 작동하지 않음**: 모든 import 문보다 앞에 있는지 확인하세요.
191191
192192
---
193193
194-
## See also {/*see-also*/}
194+
## 참고 {/*see-also*/}
195195
196-
* [`compilationMode`](/reference/react-compiler/compilationMode) - Configure how the compiler chooses what to optimize
197-
* [`Configuration`](/reference/react-compiler/configuration) - Full compiler configuration options
198-
* [React Compiler documentation](https://react.dev/learn/react-compiler) - Getting started guide
196+
* [`compilationMode`](/reference/react-compiler/compilationMode) - 컴파일러가 최적화 대상을 선택하는 방식을 설정합니다
197+
* [`Configuration`](/reference/react-compiler/configuration) - 전체 컴파일러 설정 옵션
198+
* [React Compiler documentation](https://react.dev/learn/react-compiler) - 시작 가이드

src/sidebarReference.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@
379379
]
380380
},
381381
{
382-
"title": "Directives",
382+
"title": "지시어",
383383
"path": "/reference/react-compiler/directives",
384384
"routes": [
385385
{

0 commit comments

Comments
 (0)