React 19 · Quick recall Q&A

2 min read
Senior4 min read
Rapid overview

Quick recall Q&A

Q: What is the React Compiler and do I need to change my code? A: The React Compiler automatically adds memoization. You don't need to change code, but you can remove manual useMemo, useCallback, and React.memo calls as the compiler handles optimization.
Q: What's the difference between useActionState and useFormStatus? A: useActionState manages the full action lifecycle (state, action function, pending). useFormStatus only provides pending state and must be used inside a form's child component.
Q: When should I use useOptimistic? A: Use it when you want immediate UI feedback before an async operation completes. It automatically reverts if the action fails.
Q: Can I use Server Components without a framework? A: Server Components require a bundler setup. Frameworks like Next.js, Remix, or Waku provide the necessary infrastructure. Manual setup is complex.
Q: What's the difference between Server Components and Server Actions? A: Server Components are components that render on the server (read data, no interactivity). Server Actions are functions that run on the server and can be called from Client Components (mutations, form handling).
Q: Do I still need forwardRef in React 19? A: No, function components can receive ref as a regular prop. forwardRef still works for backwards compatibility but is no longer needed.
Q: How does the use hook differ from await? A: use integrates with Suspense - it suspends the component while the promise resolves. It can also be called conditionally, unlike other hooks. It's for rendering, while await is for effects/actions.
Q: What happened to useFormState? A: It was renamed to useActionState in the final React 19 release. The functionality is the same.
Q: Should I migrate all my forms to use Actions? A: Actions work best for forms that need server interaction or complex state. Simple client-only forms can continue using controlled components with useState.
Q: How do I handle errors with Server Actions? A: Return error state from the action and handle it in the component. Use try/catch in the action and return { error: message } that the component can display.

See also