Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Official Expo team skills for building, deploying, and debugging Expo apps — fine-tuned for Claude Code.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/react-compiler.md
1# React Compiler23React Compiler is stable in Expo SDK 54 and later. It automatically memoizes components and hooks, eliminating the need for manual `useMemo`, `useCallback`, and `React.memo`.45## Enabling React Compiler67Add to `app.json`:89```json10{11"expo": {12"experiments": {13"reactCompiler": true14}15}16}17```1819## What React Compiler Does2021- Automatically memoizes components and values22- Eliminates unnecessary re-renders23- Removes the need for manual `useMemo` and `useCallback`24- Works with existing code without modifications2526## Cleanup After Enabling2728Once React Compiler is enabled, you can remove manual memoization:2930```tsx31// Before (manual memoization)32const memoizedValue = useMemo(() => computeExpensive(a, b), [a, b]);33const memoizedCallback = useCallback(() => doSomething(a), [a]);34const MemoizedComponent = React.memo(MyComponent);3536// After (React Compiler handles it)37const value = computeExpensive(a, b);38const callback = () => doSomething(a);39// Just use MyComponent directly40```4142## Requirements4344- Expo SDK 54 or later45- New Architecture enabled (default in SDK 54+)4647## Verifying It's Working4849React Compiler runs at build time. Check the Metro bundler output for compilation messages. You can also use React DevTools to verify components are being optimized.5051## Troubleshooting5253If you encounter issues:54551. Ensure New Architecture is enabled562. Clear Metro cache: `npx expo start --clear`573. Check for incompatible patterns in your code (rare)5859React Compiler is designed to work with idiomatic React code. If it can't safely optimize a component, it skips that component without breaking your app.60