Skip to content
On this page

Reduce get() usage outside of tests

get() returns current value, and it is a good solution for tests.

But it is better to use useStore(), $store, or Store#subscribe() in UI to subscribe to store changes and always render the actual data.

const { userId } = $profile.get()
const { userId } = useStore($profile)

Imported from the Nano Stores README for version 1.5.5. Improve this page there.