React·100 questions

What is state and when is it needed?

Answer
state is internal component state.
Use for data that changes over time.
Keep state as close as possible to where it's used.
Do not duplicate computed data in state.
For shared state — lift up or use a store.
Was this answer helpful?

More questions in this topic

Related questions from other topics