useState
useState returns [value, setValue]. Calling setValue queues a re-render with the new value.
- State updates may be asynchronous โ use the functional updater when next depends on previous.
- Do not mutate arrays/objects in place; copy first.
- Each component instance has its own state.
After you read this chapter, use Write (when available) and Quiz on this page to lock it in.