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
{{ message }}
Repository navigation
Commit 2b9ac13
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: src/content/learn/react-compiler/debugging.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,32 @@ Common scenarios where this occurs:
37
37
-**Dependency arrays that need stable references** - When unstable dependencies cause effects to fire too often or create infinite loops
38
38
-**Conditional logic based on reference checks** - When code uses referential equality checks for caching or optimization
39
39
40
+
## Unsupported Syntax {/*unsupported-syntax*/}
41
+
42
+
A few syntax patterns are not supported inside `try/catch` statements yet. When React Compiler encounters one of them, it skips the whole component instead of compiling it:
43
+
44
+
-**Conditional expressions** - ternaries (`condition ? a : b`) and the logical operators `&&`, `||`, and `??`
45
+
-**Optional chaining** - `object?.property`
46
+
-**`throw` statements**
47
+
-**Loops** - `for`, `for...of`, and `while` loops
48
+
49
+
These patterns are fully supported outside of `try/catch`, so moving them out of the `try/catch` (or extracting the fallible code into a separate function) restores compilation:
Skipped components still build and run normally, so the only difference is that they are not optimized. To notice them, check that the component shows the ✨ badge in React DevTools, or log skipped components with the [`logger`](/reference/react-compiler/logger) option.
65
+
40
66
## Debugging Workflow {/*debugging-workflow*/}
41
67
42
68
Follow these steps when you encounter issues:
@@ -90,4 +116,4 @@ If you believe you've found a compiler bug:
90
116
## Next Steps {/*next-steps*/}
91
117
92
118
- Review the [Rules of React](/reference/rules) to prevent issues
93
-
- Check the [incremental adoption guide](/learn/react-compiler/incremental-adoption) for gradual rollout strategies
119
+
- Check the [incremental adoption guide](/learn/react-compiler/incremental-adoption) for gradual rollout strategies
0 commit comments