Skip to content
Discussion options

You must be logged in to vote

atomWithStore uses onMount to subscribe to the Zustand store and sync it with the Jotai atom. onMount() will only be called when you subscribe to the atom but not if you just use get + set. If you use the atom inside React it will automatically work (as the hook subscribe to the atom).

You can manually subscribe to the atom, so it starts subscribing to the Zustand store:

const unsub = jotaiStore.sub(atom, () => {});

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@fenprace
Comment options

@rothsandro
Comment options

Answer selected by fenprace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
2 participants