This page is about the local state of a component.
In React, this local state is known as state
- A change of value triggers a rendering
- State is useful for handling data that is local to the component such as the data that comes from user interaction.
State value persistence
- The state value is discarded:
If you need to persist local state, you should:
- or use a state library
In React apps, whether a component is stateful or stateless is considered an implementation detail of the component that may change over time. You can use stateless components inside stateful components, and vice versa.
How to persist the local state between rendering?
State by component type
Check the dedicated page:
- Class Component: React Class Component - Local State