Creates an atom definition.
The state type.
The reducer map type.
The atom configuration (initialState, reducers).
An atom definition object.
An atom is a unit of state with an initial value and a set of reducers. It does not hold state itself but defines how state is managed.
const counterAtom = atom({ initialState: 0, reducers: { increment: (state) => state + 1, decrement: (state) => state - 1 }}); Copy
const counterAtom = atom({ initialState: 0, reducers: { increment: (state) => state + 1, decrement: (state) => state - 1 }});
Creates an atom definition.