- Low level primitives of React Framework.
- Called at top level of Components.
- Handle reactive data.
- Update the UI according to state.
- Returns an array of state and state setter.
-
- Share data without using props.
- Create a mutable object to save state on re-renders.
- Grab HTML elements from DOM.
- Instead of updating state directly we use reducer fucntion (based on redux pattern) which decides how to compute next state.
- Similar to setState().
- Cache result of function calls.
- To deal with expensive computations.
- Change the behaviour of native DOM elements.
- Make it possible to make custom labels for easy debugging of custom hooks.