* Add variant for vanilla stores
* Update text tone and style
Co-authored-by: Blazej Sewera <code@sewera.dev>
* Adjust code style to match zustand's one
* Run prettier
---------
Co-authored-by: Blazej Sewera <code@sewera.dev>
The initialization type of `useState` is incorrect. hydrated needs to be of boolean type, whereas the original `useBoundStore.persist.hasHydrated` is a function. This will lead to errors, such as during the static build of frameworks like Next.js.
* Add section for usage of persist middleware with NextJS
I have spent the last 1h30m trying to find the solution for `Hydration failed because the initial UI does not match what was rendered on the server` and after digging a lot I found the solution.
So i thought: Maybe this could be on official documentation!
So I made it. It's just copy and paste but at least it will be easier for future folks trying to solve the same problem
* ran yarn prettier
* fix typos
* Update docs/integrations/persisting-store-data.md
Co-authored-by: Blazej Sewera <code@sewera.dev>
* splitting long lines into smaller ones
following the suggestion of PR
* commit suggestion of changes in PR
Co-authored-by: Blazej Sewera <code@sewera.dev>
* commit suggestion of changes in PR
Co-authored-by: Blazej Sewera <code@sewera.dev>
* commit suggestion of changes in PR
Co-authored-by: Blazej Sewera <code@sewera.dev>
* commit suggestion of changes in PR
Co-authored-by: Blazej Sewera <code@sewera.dev>
* applying changes requested in PR
---------
Co-authored-by: Blazej Sewera <code@sewera.dev>
* Add Slices pattern example
By ading this example we can combine the real Slices pattern implementation (instead of multiple stores) with the resetAll method. Hope this helps! 😄
* Removed commetns and fixed typo
* Last PR changes
* docs: Fix Jest example's usage of default imports
Default exports and imports are deprecated. The default import of `zustand` generates a deprecation warning on the console. The default export that was suggested previously would actually fail to compile. See the comments at the very bottom of #559 for further discussion.
This commit fixes the example in the documentation by introducing named exports & imports instead of default exports & imports.
* docs: Suggest using plain import for Jest
`jest.requireActual` is not necessary when we're not mocking any other
part of `zustand`.
* docs: Fix TypeScript example
The `create` function was curried where it should not have been.
The example is now written in plain TypeScript, as the code that it
contains does not require JSX.
* Prettier suggestions
* Use `jest.requireActual` to avoid circular dependencies
* Make bounded useStore recipe section minimal
* Add a receipe for `createBoundedUseStore`
* run prettier
* use vanilla store
(as the react store is already a bounded useStore hook)
* docs: remove now superfluous warning messages
Co-authored-by: Chris K <55621012+chrisk-7777@users.noreply.github.com>
* docs: clean up getting started doc group
* docs: remove unnecessary comma from comparison page
* docs: reformat recipies (1/2)
* docs: reformat recipies (2/2)
Co-authored-by: Chris K <55621012+chrisk-7777@users.noreply.github.com>
* update documentation of persist to include how to handle Map and Set with the new persist API
* run prettier
* Update docs/integrations/persisting-store-data.md
Co-authored-by: Chris K <55621012+chrisk-7777@users.noreply.github.com>
* Update docs/integrations/persisting-store-data.md
Co-authored-by: Chris K <55621012+chrisk-7777@users.noreply.github.com>
* Update docs/integrations/persisting-store-data.md
Co-authored-by: Blazej Sewera <code@sewera.dev>
* edit suggestions
* fix comment
Co-authored-by: Chris K <55621012+chrisk-7777@users.noreply.github.com>
Co-authored-by: Blazej Sewera <code@sewera.dev>