AI summary by TwinMind
React 19 Is Here - Are You Ready?
Theo - t3․gg
20m 11s
React Compiler Evolution
- React compiler no longer research project, shipped to production across all of Instagram.com
- Eliminates need for manual memoization (useMemo, useCallback, memo APIs)
- Automatically optimizes re-renders without compromising React's core mental model
- Compiles code safely by modeling JavaScript rules and React rules (components must be idempotent)
- Detects when code doesn't follow React's rules - either compiles safely or skips compilation
- Testing against Meta's large/varied codebase for validation
- ESLint rules being developed to keep code within optimizable bounds
- Consolidated documentation of React rules coming
- Open source release planned for coming months
Actions System Overhaul
- Server actions extended to support client-only applications
- Actions allow passing functions to DOM elements (forms)
- Can operate synchronously or asynchronously
- Define client-side (standard JavaScript) or server-side (use server directive)
- React manages data submission lifecycle
- New hooks: useFormStatus, useFormState for accessing current state/response
- Actions submitted within transitions by default (keeps page interactive)
- Added async/await support within transitions
- useOptimistic hook for managing optimistic state updates
- Applies temporary updates, automatically reverts when final state commits
- Works with regular async, same behavior for fetch or server actions
React Canary Process
- New development approach - building in public vs privately at Meta
- Community can provide feedback during development (vs after completion)
- Server components, asset loading, document metadata, actions all landed in Canary
- Canaries allow adopting stable features before official stable release
New Built-in Features
- Directives:
- use client: instructs bundler to generate script tag (like Astro islands)
- use server: instructs bundler to generate POST endpoint (like tRPC mutations)
- Document Metadata: Built-in support for title, meta, link tags anywhere in component tree
- Works in all environments (client-side, SSR, RSC)
- Replaces libraries like react-helmet
- Asset Loading: Suspense integration with stylesheets, fonts, scripts lifecycle
- New APIs: preload, preinit for resource loading control
- Prevents flash of unstyled content by waiting for style tags
React 19 Release Plans
- Current Canary features complete and ready for stable release
- Breaking changes coming: asset loading, document metadata
- Web components support finally being added
- Activity feature (renamed from offscreen) deprioritized
- Allows running components in background without blocking main thread
- Virtual DOM continues without real DOM updates until chosen
- Focus on shipping complete feature sets rather than individual pieces
- More documentation and announcements coming in following months
