Usage of subscribeWithSelector in vanilla stores #1328
Unanswered
evancloutier
asked this question in
General
Replies: 3 comments 5 replies
-
Is this a JS question? Not about TS? Line 74 in 5ca63d1 It should just attach the same api... |
Beta Was this translation helpful? Give feedback.
0 replies
-
Btw, I generally suggest to avoid subscribeWithSelector for new projects (it's meant for migration). It doesn't give any performance improvement and typing is really hard. |
Beta Was this translation helpful? Give feedback.
5 replies
-
For typing a vanilla store correctly with middleware, you probably need |
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
-
What is the correct way to initialize and type a vanilla store with the
subscribeWithSelector
?I'm using zustand in a class like so:
I'd like to add
subscribeWithSelector
into the bound store instance, but I can't quite figure out the correct way to do so. I've tried:But it seems that the selector functionality doesn't propagate to the bound store.
I'd like to subcribe by doing:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions