You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello dear jotai team. I liked this store manager because it has all needed features. I've been trying to migrate from mobx store to jotai, and I'm facing with one bug.
I have 2 components App and ParentFruit which use one atom - pricesAtom
When I added new price in App component the child component - ParentFruit doesn't see this new one object and doesn't render this new one
There is the same problem with arrays too - todosAtom
The problem is where your Provider is placed. The useAtom call in your App component is not wrapped in a provider and therefore uses the default store of Jotai. Your ParentFruit component is wrapped in a Provider and therefore uses a separate store, not the default store.
constApp=()=>{const[...]=useAtom(fruitsAtom);// (1) Default storereturn(<Provider><ParentFruit/> // (2) Store from Provider
<button>Add Fruit</button></Provider>);};
The Provider should be at the root of your application, everything should be wrapped in the provider.
Summary
Hello dear jotai team. I liked this store manager because it has all needed features. I've been trying to migrate from mobx store to jotai, and I'm facing with one bug.
I have 2 components App and ParentFruit which use one atom - pricesAtom
When I added new price in App component the child component - ParentFruit doesn't see this new one object and doesn't render this new one
There is the same problem with arrays too - todosAtom
Link to reproduction
Link to sandbox reprodaction
Check List
Please do not ask questions in issues.
Please include a minimal reproduction.
The text was updated successfully, but these errors were encountered: