Replies: 2 comments 3 replies
-
Thanks for opening a discussion. This sounds like a field where we still look for a best practice. Feedback and suggestions are welcome from anyone. One idea would be to use const fooAtom = atomWithQuery(...)
let globalToken
const Component = () => {
const [foo] = useAtom(fooAtom)
const { token } = foo
useEffect(() => {
globalToken = token
return () => {
globalToken = null
}
}, [token])
...
} |
Beta Was this translation helpful? Give feedback.
2 replies
-
Outside of what @dai-shi suggested, another option to access query data outside of react would be to define a custom |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I've been using jotai and the query integration to cache data from my api. In this particular instance a user atom.
I now need to access that from outside react (push notification functions which needs to live outside of the render tree).
Is there a way to have connect an atomwithQuery to say zustand so it can be accessed from outside react?
Beta Was this translation helpful? Give feedback.
All reactions