@@ -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 Compiler がコンパイル対象の関数をどのように選択するか制御します。
88
99</Intro >
1010
@@ -18,56 +18,56 @@ 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 Compiler が最適化する関数を決定する方法を制御します。
2626
2727#### Type {/* type* /}
2828
2929```
3030'infer' | 'syntax' | 'annotation' | 'all'
3131```
3232
33- #### Default value {/* default-value* /}
33+ #### デフォルト値 {/* default-value* /}
3434
3535` 'infer' `
3636
3737#### Options {/* 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 コンポーネントとフックを識別します。
40+ - ` "use memo" ` ディレクティブで明示的に注釈された関数
41+ - コンポーネント(パスカルケース)やフック( ` use ` プレフィックス)のように命名され、かつ JSX を作成または他のフックを呼び出す関数
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/ ) 構文を使用するコンポーネントとフックのみをコンパイルします。
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
7373// ✅ Compiled: Named like a component + returns JSX
@@ -93,17 +93,17 @@ function calculateTotal(items) {
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
109109// Only this function will be compiled
@@ -124,17 +124,17 @@ function NormalComponent(props) {
124124}
125125```
126126
127- ### Using Flow syntax mode {/* flow-syntax-mode* /}
127+ ### Flow syntax モードの使用方法 {/* 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
140140// Compiled: Flow component syntax
@@ -154,9 +154,9 @@ function helper(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
162162function ComponentWithSideEffects () {
@@ -171,11 +171,11 @@ 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
181181// ❌ Won't be compiled: lowercase name
0 commit comments