State with useState
Add memory to a component with useState, understand why updates are asynchronous and batched, and learn the rules for updating objects and arrays.
- Level
- Beginner
- Chapters
- 4
- Exercises
- 2
- Reading time
- 16 min
What you will cover
- 1. Why State ExistsThe difference between a value that survives a render and one that does not.
- 2. Updates Are AsynchronousWhy the value does not change immediately, and what batching means for your code.
- 3. Objects and Arrays in StateWhy you must replace state instead of mutating it, and the patterns for doing so.
- 4. State in PracticeSharing state between components and building a working counter.
Up next after this one: Events and Conditional Rendering