This hook subscribes a callback to be executed every time there is a change to Recoil atom state. Multiple updates may be batched together in a single transaction. This hook is great for persisting state changes, dev tools, building history, &c.
The callback provides a
Snapshot of the current and previous state for the React batch transaction. If you would only like to subscribe to changes for individual atoms, consider effects instead. In the future, we may allow the ability to subscribe to specific conditions or provide debouncing for performance.