Store is not callable as a hook in react #1121
-
|
A follow up to #1113 I'm using the commit based package mentioned there. @dai-shi I'm getting an error where the hook created by createStore isn't callable. It doesn't seem to be a function when i try to use it in a react funtion. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
i'm using the curried example from typescript |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, Please use import create from 'zustand'I know people (and IDEs) get confused with new APIs. |
Beta Was this translation helpful? Give feedback.
-
|
@dai-shi thank you so much for the explanation. maybe you can move this to discussion to make it available to others? |
Beta Was this translation helpful? Give feedback.
-
|
Update: zustand v5.0.8 default export doesn't exists |
Beta Was this translation helpful? Give feedback.
Yeah,
createStorecreates a vanilla store, which must be used withuseStore.Please use
createfrom the default export.I know people (and IDEs) get confused with new APIs.