Client-side Loaders?
I have an external
@xstate/store
which I use to keep track of some user preferences. Those preferences get persisted via cookies and loaded during beforeLoad
. What is the correct way to populate a client side store like xstate with those values from the server? I know I could:
but my gut tells me this is the wrong solution.
I could put preferencesStore.send({ event: "initialize", preferences: userPreferences });
in the Route's loader
but that runs on both the client AND the server, correct? The preferencesStore
should really only "exist" client side. WWYD?0 Replies