share state array between pages
Hey guys so the idea is pretty simple but I'm kinda stuck to achieve this. So I have functionality when I click a button I add id to the array, when I click it again I remove the id from the array. But now I want to use this array also in different page. For context I'm trying to build a "favorite list" so I probably need to preserve this array somehow, maybe with local storage? How should I go about this?
11 Replies
Zustand
https://github.com/pmndrs/zustand
State management
GitHub
GitHub - pmndrs/zustand: 🐻 Bear necessities for state management in...
🐻 Bear necessities for state management in React. Contribute to pmndrs/zustand development by creating an account on GitHub.
ill look into it thx
GitHub
GitHub - barrybtw/zustand-example
Contribute to barrybtw/zustand-example development by creating an account on GitHub.
i made a tiny example
with typescript ofc
ooh thx, that will be helpful for sure
if you wanted to persist on localstorage theres the persist middleware seen here: https://docs.pmnd.rs/zustand/integrations/persisting-store-data
Zustand Documentation
Zustand Documentation
Zustand is a small, fast and scalable bearbones state-management solution, it has a comfy api based on hooks
+ the docs
my eyes D:
they should do dark mode 😄
lol
yeah
but its from poimandres
same people from react three fiber, react spring, a11y, drei and other things
they do cool stuff
yeah im ignorant and only for now know them from using their theme in vscode xD