-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
please highlight breaking changes when migrating from v2 to v3 (( thank you )). #159
Comments
it's in the release tag https://github.com/react-spring/zustand/releases/tag/v3.0.0 there are no breaking changes in this release. but v4 will cut off the tuple api. |
Actually, I'd like to highlight a breaking change. When using This is highlighted here: Compared to what was there for 2.x: Unless I missed something already mentioned before, please highlight this as a breaking change from 2 -> 3 so it's clear for all. This tripped our upgrade to |
@uzairfaisal |
@dai-shi the fix you're referring to is adding the Afaik, devtools should works for us in v2 (CC: @timkindberg) though I haven't explicitly checked this. The very same code example that should work in v2 in that post you linked would const [useStore] = create(devtools(set => ({
count: 1,
inc: () => set(state => ({ count: state.count + 1 }), 'inc'), // in v3, the 2nd param is for replace and in v2, the 2nd param is for name
dec: () => set(state => ({ count: state.count - 1 }), 'dec') // same here
}))) It should instead be const [useStore] = create(devtools(set => ({
count: 1,
inc: () => set(state => ({ count: state.count + 1 }), false, 'inc'), // notice the 2nd param change
dec: () => set(state => ({ count: state.count - 1 }), false, 'dec') // same here
}))) If I don't pass |
That was a huge misunderstanding of mine. Thanks for noting. |
Please note there is still in issue in relation to Typescript which has been mentioned but thought I would highlight it again as it still expects 1-2 arguments and not 3 as above if you use the SetState type referencing #705 (comment) |
@MarkAPhillips TS support is changed and should be improved in v4. Please open a new issue with a reproduction. |
@dai-shi thanks - I realise the issue now and more relates to documentation - that is you can use the |
so far I was able to identify 1 breaking change in the lib api.
The text was updated successfully, but these errors were encountered: