I have following recoil atom:
export const BasketA = atom({
key: 'basket',
default: [] as any
})
Components on route /test which updates this:
const [basket, setBasket] = useRecoilState(BasketA);
const handleAddBookToBasket = () => {
setBasket((basket: any) => [...basket, book]);
}
Now if we go to the basket route /basket and do:
const basket = useRecoilValue(BasketA)
When i console.log this basket, the basket is empty. I know that adding items to basket works, cuz in the first component, console logs displayed correct with filled data
So, my question is: Why the basket is empty after redirect to another route