Replies: 1 comment 1 reply
-
|
I don't think nobody created such middleware for your pattern. You would be the first to create one. 😄 If it's basically injecting an action dynamically, what you could do in bare zustand is something like this: const useFooStore = ((set) => ({
foo: 1,
doSomething: () => { /* ... */ },
})
useFooStore.setState({ doSomething: () => { /* ... * } })I don't think zustand slice pattern is same as RTK's. If you want namespacing, reach out some third-party libraries. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Slice patterns are helpful for maintaining large applications, and are similar to the redux toolkit's createSlice, but how to use patterns like
extraReducers? A further way is to treat state of slice as a state machine.for example on doc:
But in the concepts of the state machine, the bear slice shouldn't care about how to mutate
fishesSo it may become such:
Another proposal is that we can create the same action name, which will be executed on both sides.
(Now it will be overridden to execute only the last action in
create)Beta Was this translation helpful? Give feedback.
All reactions