jotai: Jotai async atom not working with expo-router
Summary
It looks like async read atoms are not working well with expo-router No issue using classic expo with App.js. When using expo-router, page is blank.
const countAtom = atomWithAsyncStorage('countAtom', 0)
const count2Atom = atom(async (get) => (await get(countAtom)) * 2)
export const Component = () => {
const [count] = useAtom(count2Atom)
console.log(count)
return <Text>Component {count}</Text>
}
Link to reproduction
https://github.com/smontlouis/jotai-async
Replace package.json “main” entry with either “expo-router/entry” or “node_modules/expo/AppEntry.js” to see jotai not working with expo-router
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 18 (9 by maintainers)
Omg it’s failing ! Thank you for your time I’ll report to them !