I made a simple store to share state between islands #588
amoreaulemay
started this conversation in
Show and tell
Replies: 1 comment
-
Hell yeah, I will definitely need it. |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Although it is framework agnostic, I made a simple store solution that works well with Fresh to share state between islands.
I read previous discussions (#230 and #519) on the subject, and Zustand and Statery were suggested, but I could not get them to work how I needed them to do for my projects.
So I did a simple observer pattern that attaches to the window object. I tried to do a store with minimal dependencies, and the only one is a polyfill from corejs that auto imports if the browser doesn't support
structuredClone
.It's now in a working state, and is documented well enough, I'm now working on adding more tests.
Here's the link to the repo : https://github.com/amoreaulemay/fresh-store
Hope it helps someone!
Beta Was this translation helpful? Give feedback.
All reactions