Skip to content

Trying to combine two stores #1854

Discussion options

You must be logged in to vote

@FlorianGoussin what you are looking for is the slices pattern https://docs.pmnd.rs/zustand/guides/slices-pattern

The solution

const createSelectionStore = (set) => ({ ... })
const createBikePathStore = (set) => ({ ... })

Note: you shouldn't use create with createSelectionStore and createBikePathStore those are slices, just regular functions

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by FlorianGoussin
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dai-shi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants