A custom hook that creates a state reference.
The reference provides access to the state, along with event dispatching, validation, and confirmation logic.
Registers a callback to be invoked when the state changes.
Accepts a sync function, a cleanup function, or a function returning a Promise (which will be ignored).
A custom hook that creates a state reference. The reference provides access to the state, along with event dispatching, validation, and confirmation logic.