Children components don't see update of one atom in parent one #2550
Unanswered
AlekseyP18
asked this question in
Q&A
Replies: 1 comment
-
The problem is where your const App = () => {
const [...] = useAtom(fruitsAtom); // (1) Default store
return (
<Provider>
<ParentFruit /> // (2) Store from Provider
<button>Add Fruit</button>
</Provider>
);
}; The const App = () => {
return (
<Provider>
<DeliciousFruits />
</Provider>
);
}
const DeliciousFruits = () => {
const [...] = useAtom(fruitsAtom);
return (
<ParentFruit />
<button>Add Fruit</button>
);
}; PS. I think it's better to open a discussion instead of an issue for the next time. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
Beta Was this translation helpful? Give feedback.
All reactions