Search across all documentation pages
16 pages in this section.
11 examples to get you started with React Hooks -- 7 basic and 4 intermediate.
Extract reusable stateful logic into functions that start with use — React's primary code reuse mechanism.
Synchronize a component with an external system by running side effects after render.
Read and subscribe to context from any component without prop drilling.
Manage complex state transitions with a reducer function and dispatched actions.
Cache the result of an expensive computation between renders.
Cache a function definition between renders to maintain a stable reference.
Hold a mutable value that persists across renders without causing re-renders.
Generate a unique, stable ID for accessibility attributes that is consistent between server and client.
Mark state updates as non-urgent so they don't block user input.
Defer updating a part of the UI to keep the rest responsive during expensive renders.
Manage form state driven by an action function, with built-in pending state and progressive enhancement.
Show an optimistic (predicted) state while an async action is in progress, then reconcile when it completes.
A condensed summary of the 25 most important best practices drawn from every page in this section.