You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/learn/react-compiler.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,9 +19,13 @@ title: React 컴파일러
19
19
</YouWillLearn>
20
20
21
21
<Note>
22
+
<<<<<<< HEAD
22
23
React 컴파일러는 커뮤니티로부터 초기 피드백을 받기 위해 오픈소스로 공개된 새로운 실험적 컴파일러입니다. 아직 안정적이지 않으며 프로덕션 환경에서는 완전히 준비되지 않았습니다.
23
24
24
25
React 컴파일러는 React 19 RC를 필요로 합니다. React 19로 업그레이드할 수 없는 경우 [워킹 그룹](https://github.com/reactwg/react-compiler/discussions/6)에 설명된 대로 사용자 공간 캐시 함수 구현을 시도해 볼 수 있습니다. 그러나 이 방법은 권장하지 않으며 가능한 한 React 19로 업그레이드하는 것이 좋습니다.
26
+
=======
27
+
React Compiler is a new experimental compiler that we've open sourced to get early feedback from the community. It still has rough edges and is not yet fully ready for production.
28
+
>>>>>>> 2b2d0f2309f49c82cf5bb88ea62fb2e44661c634
25
29
</Note>
26
30
27
31
React 컴파일러는 빌드 타임 전용 도구로 React 앱을 자동으로 최적화합니다. 순수 JavaScript로 동작하며 [React의 규칙](/reference/rules)을 이해하므로 코드를 다시 작성할 필요가 없습니다.
@@ -226,6 +230,29 @@ module.exports = function () {
226
230
227
231
`babel-plugin-react-compiler`는 다른 Babel 플러그인보다 먼저 실행되어야 합니다. 이는 컴파일러가 사운드 분석(sound analysis)을 위해 입력 소스 정보를 필요로 하기 때문입니다.
228
232
233
+
React Compiler works best with React 19 RC. If you are unable to upgrade, you can install the extra `react-compiler-runtime` package which will allow the compiled code to run on versions prior to 19. However, note that the minimum supported version is 17.
234
+
235
+
<TerminalBlock>
236
+
npm install react-compiler-runtime@experimental
237
+
</TerminalBlock>
238
+
239
+
You should also add the correct `target` to your compiler config, where `target` is the major version of React you are targeting:
{/* TODO T164397693: link to actions documentation once it exists */}
37
37
38
+
<<<<<<< HEAD
38
39
컴포넌트 최상위 레벨에서 `useActionState`를 호출하여 [폼 액션이 실행될 때](/reference/react-dom/components/form) 업데이트되는 컴포넌트 state를 생성합니다. `useActionState`에 기존의 폼 작업 함수와 초기 state를 전달하면, 최신 폼 state와 함께 폼에서 사용하는 새로운 액션을 반환합니다. 최신 폼 state 또한 제공된 함수에 전달됩니다.
40
+
=======
41
+
Call `useActionState` at the top level of your component to create component state that is updated [when a form action is invoked](/reference/react-dom/components/form). You pass `useActionState` an existing form action function as well as an initial state, and it returns a new action that you use in your form, along with the latest form state and whether the Action is still pending. The latest form state is also passed to the function that you provided.
42
+
>>>>>>> 2b2d0f2309f49c82cf5bb88ea62fb2e44661c634
39
43
40
44
```js
41
45
import { useActionState } from"react";
@@ -71,10 +75,18 @@ Server Action과 함께 사용하는 경우, `useActionState`를 사용하여 hy
71
75
72
76
#### 반환값 {/*returns*/}
73
77
78
+
<<<<<<< HEAD
74
79
`useActionState`는 정확히 두 개의 값이 담긴 배열을 반환합니다.
75
80
76
81
1. 현재 state입니다. 첫 번째 렌더링에서는 전달한 `initialState`와 일치합니다. 액션이 실행된 이후에는 액션에서 반환한 값과 일치합니다.
77
82
2. `form` 컴포넌트의 `action` prop에 전달하거나 폼 내부 `button` 컴포넌트의 `formAction` prop에 전달할 수 있는 새로운 액션입니다.
83
+
=======
84
+
`useActionState` returns an array with the following values:
85
+
86
+
1. The current state. During the first render, it will match the `initialState` you have passed. After the action is invoked, it will match the value returned by the action.
87
+
2. A new action that you can pass as the `action` prop to your `form` component or `formAction` prop to any `button` component within the form.
88
+
3. The `isPending` flag that tells you whether there is a pending Transition.
89
+
>>>>>>> 2b2d0f2309f49c82cf5bb88ea62fb2e44661c634
78
90
79
91
#### 주의 사항 {/*caveats*/}
80
92
@@ -104,10 +116,18 @@ function MyComponent() {
104
116
}
105
117
```
106
118
119
+
<<<<<<< HEAD
107
120
`useActionState`는 정확히 두 개의 항목으로 구성된 배열을 반환합니다.
108
121
109
122
1. 폼의 <CodeStep step={1}>현재 state</CodeStep>입니다. 처음에는 제공한 <CodeStep step={4}>초기 state</CodeStep>로 설정되며, 폼이 제출된 후에는 전달한 <CodeStep step={3}>액션</CodeStep>의 반환값으로 설정됩니다.
`useActionState` returns an array with the following items:
126
+
127
+
1. The <CodeStep step={1}>current state</CodeStep> of the form, which is initially set to the <CodeStep step={4}>initial state</CodeStep> you provided, and after the form is submitted is set to the return value of the <CodeStep step={3}>action</CodeStep> you provided.
128
+
2. A <CodeStep step={2}>new action</CodeStep> that you pass to `<form>` as its `action` prop.
129
+
3. A <CodeStep step={1}>pending state</CodeStep> that you can utilise whilst your action is processing.
0 commit comments