I am curious if the type of listeners includes parameters for version compatibility reasons. #2593
Answered
by
dai-shi
MyohanMyolang
asked this question in
Q&A
|
When using useSyncExternal, they call subscribe like this: const handleStoreChange = () => {
if (checkIfSnapshotChanged(inst)) {
forceStoreRerender(fiber);
}
};
return subscribe(handleStoreChange);However, the current Listener type is defined as: type Listner = (state: TState, prevState: TState) => voidIs this done for version compatibility reasons? |
Answered by
dai-shi
Jun 10, 2024
Replies: 1 comment 3 replies
|
Are you referring to the difference between useSyncExternalStore listener and Zustand listener? |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure, that's technically possible. It's the design choice that Zustand listener takes
stateandprevState.