Skip to content
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

zustand/context: drop initialStore and add createStore #445

Closed
dai-shi opened this issue Jun 21, 2021 · 4 comments · Fixed by #447
Closed

zustand/context: drop initialStore and add createStore #445

dai-shi opened this issue Jun 21, 2021 · 4 comments · Fixed by #447

Comments

@dai-shi
Copy link
Member

dai-shi commented Jun 21, 2021

#402 (comment)

I think initialStore can easily be misused, and requires memoization on caller.

@dai-shi
Copy link
Member Author

dai-shi commented Jun 21, 2021

@Munawwar Are you around?

@Munawwar
Copy link
Contributor

@dai-shi I was away for a while. I have to recollect the next.js issues again. I will try this new solution on the next.js example

@Munawwar
Copy link
Contributor

Munawwar commented Jun 22, 2021

Ok I managed to get next.js working with new interface. https://codesandbox.io/s/nextjs-with-zustand-354-forked-bryjr?file=/lib/store.js
So that's great. 👍

Though once again I thought createStore would create store every time. So it is more like createStoreOnce or createInitialStore.

@dai-shi
Copy link
Member Author

dai-shi commented Jun 22, 2021

Thanks for confirming.

About naming, I thought about adding Initial, but thought maybe obvious. Let's wait and see if others report confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants