0 of 2 saved

React5 min read

useState

Read this chapter, then pass a short check to open the next one.

Local component state.

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.