Jotai is a state management library for React. You will learn how it can be used instead of useState for shared state.
We'll start with two Counter
components that each have their own React useState
instance which isolates the state to that component. To share state, we'll create an atom
from jotai and replace the useState
calls to useAtom
, and that's it, you have shared state.