129 Commits

Author SHA1 Message Date
Mohammed 'Mo' Mulazada
f73736d59a
improve docs readability (#1931)
* make codeblock easier to understand

* add explanation to what mock does

* add info block

* rewrite typescript section

* Update typescript.md

* Update docs/guides/testing.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* prefix with >

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-07-13 18:01:47 +09:00
Luiz Felicio
808a72225e
docs(auto-generating-selectors): Add vanilla store variant (#1915)
* 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>
2023-07-05 08:38:35 +09:00
Surya Vivek
58947a5bf9
docs: fix typo 'with be' to 'will be' (#1906) 2023-06-30 09:03:15 +09:00
Danilo Britto
1b557cba07
Testing docs minor fixes (#1898)
* Minor fixes

* Update testing.md

* Update testing.md
2023-06-28 08:07:11 +09:00
Lars Artmann
3584d5075a
Update comment //store.ts to //store.tsx in zustand-v3-create-context.md (#1893) 2023-06-23 16:18:09 +09:00
Danilo Britto
9333eb629c
Improve testing docs (#1875)
* Update testing docs (wip)

* WIP

* WIP

* Update testing docs

* Minor updates
2023-06-23 07:58:13 +09:00
Kiku
7276b531bc
docs: correct import alias syntax (#1889) 2023-06-21 20:01:30 +09:00
Chris K
e8597ae77f
docs: refine flux inspired docs to make pattern inspiration clearer (#1874)
* docs: refine flux inspired docs to make pattern inspiration clearer

* docs: remove the immutable note in the flux inspired docs
2023-06-18 11:42:01 +09:00
Ivo Ilić
a53433543c
Added zustand-ards to the third-party libraries list (#1856)
* Added zustand-ards to the third-party libraries list

* Update third-party-libraries.md
2023-06-11 06:55:37 +09:00
David Corbacho
84c7323c8e
[Documentation] Import shallow from right package (#1847) 2023-06-07 21:59:48 +09:00
Romain
3a365a0804
docs: added a new third party lib (#1843)
* docs: added a new third party lib

* chore: prettier
2023-06-07 16:53:44 +09:00
Dmitri Cusnir
eb5ec74c3d
Update third-party-libraries.md (#1827)
rename npm package zustand-fetching -> leiten-zustand
2023-05-27 07:50:02 +09:00
203X
ac4ec46bd6
fix useHydration hook (#1826)
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.
2023-05-27 07:49:28 +09:00
Dmitri Cusnir
8cb150ae8a
Update third-party-libraries.md (#1816)
* Update third-party-libraries.md

* Update docs/integrations/third-party-libraries.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update third-party-libraries.md

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-05-22 19:31:40 +09:00
Will McBride
d61b70fd8d
Update Recipes persist example to match example in Persisting Store Data integration (#1813)
Replace the deprecated `getStorage` option with the new `storage` option with `createJSONStorage`.
2023-05-18 07:53:10 +09:00
Celine Cheng
286e4436c7
docs: persist and connect state with url (#1804)
* docs: persist and connect state with url

* ran prettier

* remove line

* Apply suggestions from code review

Co-authored-by: Blazej Sewera <code@sewera.dev>

* from review comments

---------

Co-authored-by: celinecheng <celine.cheng@capitalone.com>
Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-05-17 20:52:02 +09:00
Alex S
56ab6db790
docs: fixes typo on variable name (#1810) 2023-05-17 20:11:58 +09:00
Vadim Shvetsov
614bf5fbbb
Fix saving URL hash example demo (#1800) 2023-05-12 08:14:44 +09:00
Nipodemos
65d2bc0660
Add section for usage of persist middleware with NextJS (#1782)
* 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>
2023-05-08 08:25:00 +09:00
Brendan Dash
639aa00699
docs(recipes): fix description of devtools store naming (#1792) 2023-05-05 21:30:40 +09:00
Arul Murugavel B
22db0014bb
Add code heading in comparison with Zustand and Redux (#1777)
* Add code heading

* Add newline

Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>

---------

Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>
2023-04-30 22:31:33 +09:00
Daniels L
e71e313bd7
docs(typescript): fix bounded use store example (#1779)
* test: changer

* docs: fix abstract bounded store hook TS example

Fixes type issues due to optional arg:
https://github.com/pmndrs/zustand/discussions/1564#discussioncomment-5735802

* fix: pr feedback
2023-04-28 17:40:42 +09:00
Tim Arney
513b22283e
Update Transient in recipes to match Readme (#1764)
* Update Transient in recipes to match Readme



https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes

* Update docs/recipes/recipes.mdx

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* update to useScratchStore

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-04-24 23:29:29 +09:00
Arvin Xu
a999f7ac04
docs: fix document error of persist with hydration (#1758)
* docs: fix document error of persist with hydration

* Update persisting-store-data.md

* Apply suggestions from code review

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update persisting-store-data.md

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-04-18 18:49:56 +09:00
zc627788
df38aa8c5a
Fix document details (#1752)
export const useBoundStore = create((set) => ({
  count: 0,
  text: 'hello',
  inc: () => set((state) => ({ count: state.count + 1 })),
  setText: (text) => set({ text }),
})

example on this page is missing a trailing parenthesis
2023-04-17 11:01:56 +09:00
Danilo Britto
4c2c482820
fix(docs): update testing doc (#1739)
* Update formatting

* Update testing doc

* Fix formatting

* Minor changes

* Update testing doc
2023-04-07 20:49:00 +09:00
Jacob Weisenburger
f94ad23b43
fixes #1735 (#1737) 2023-04-07 11:54:45 +09:00
George Manning
38c905564c
feat(middleware/persist): add skip hydration option #405 (#1647)
* add manual hydration option to persist middleware

* rename variable, update jsdoc, remove from oldImpl

* add tests for persist skipHydration

* add docs

* Update docs/integrations/persisting-store-data.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update docs/integrations/persisting-store-data.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update src/middleware/persist.ts

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-03-31 20:20:16 +09:00
Yehyoung Kang
e489a63513
Don't recommend memoizing selectors (#1707)
As per the discussions below, memoizing selectors does not improve performance
significantly as of v4. Thus we should avoid recommending selector memoization.
Note that the same paragraph was removed from the README in PR #550
(https://github.com/pmndrs/zustand/pull/550)
and this section may have been left behind as an oversight.

- https://github.com/pmndrs/zustand/discussions/658
- https://github.com/pmndrs/zustand/discussions/971
2023-03-22 18:09:14 +09:00
hellohy
baf9b309c1
fix(doc): update state-with-url-hash demo (#1687)
* fix(doc): update state-with-url-hash demo

* fix(doc): url-hash demo better code
2023-03-17 10:26:06 +09:00
Kevin Jiang
0ee21f8dbc
Update imports (#1674) 2023-03-04 19:44:36 +09:00
Chris Olmsted
5b8abb2f70
docs: added 'zukeeper' to integrations/third-party-libraries (#1670) 2023-03-02 09:45:08 +09:00
Juanma Antonellini
de74f2e32d
fix(docs): Add Slices pattern example (#1485)
* 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
2023-02-28 10:56:30 +09:00
Aleksandar Dimitrov
38ccc1ffb1
Fix Jest example's usage of default imports (#1641)
* 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
2023-02-27 10:58:11 +09:00
Blazej Sewera
fbfcdc54e6
fix(docs): resolve different section linking behavior with special characters (#1640) 2023-02-17 21:36:52 +09:00
Devin Deng
c1970e9358
docs: add zustand-vue/zustand-pub in third-party-libraries.md and run prettier (#1633) 2023-02-14 11:45:53 +09:00
Sajad Torkamani
3788fe3652
Fix typo (#1606) 2023-02-08 07:17:22 +09:00
João Paulo Lousada
67f06df9be
docs: include "ngx-zustand" to third-party-libraries.md (#1605) 2023-02-07 11:21:10 +09:00
Devansh Jethmalani
f508b2c315
docs(typescript): clean up bounded useStore recipe (#1581)
* 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)
2023-01-30 08:23:26 +09:00
Holger Grosse-Plankermann
04080fdedc
fix(docs/typescript): provide example how to use middlewares with #1565 (#1578) 2023-01-27 09:00:31 +09:00
Holger Grosse-Plankermann
1023eb4af4
fix(docs/typescript): use correct initial state in test example (#1577) 2023-01-26 19:55:37 +09:00
Holger Grosse-Plankermann
44b23382f0
fix(docs/typescript): add typing usage with custom store hooks (#1565)
* Docs for discussion 1564

* Apply prettier

* fix(docs/typescript): use overloading example discussed in #1564
2023-01-25 11:52:53 +09:00
Blazej Sewera
2f2fee4803
Remove warnings and clean up getting started docs (#1559)
* 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>
2023-01-20 09:06:17 +09:00
Yota Hada
1df4f6110e
docs: update testing (#1550) 2023-01-18 14:48:14 +09:00
nitedani
9cf71d2927
Update third-party-libraries.md (#1544)
Add my library, [zustand-querystring](https://github.com/nitedani/zustand-querystring)
2023-01-16 18:32:48 +09:00
CatMonster
2274eb90b2
Invalid example (#1539)
Add missing close parenthesis on Zustand example
2023-01-12 22:57:19 +09:00
Charles Kornoelje
3c03e40f93
Add zustand-di (#1532)
Add zustand-di third-party package in anticipation of `createContext` from `zustand/context` being removed in v5 of zustand.
2023-01-11 14:23:10 +09:00
Daishi Kato
55d0c3aec9
docs: add migration example in v3 create context (#1524)
* docs: add migration example in v3 create context

* fix markdown

* minor fix
2023-01-10 21:54:30 +09:00
William
725c2c0cc0
doc: update documentation of persist (#1512)
* 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>
2023-01-10 18:20:03 +09:00
Daishi Kato
0b55a3d74b
feat: deprecate default export (#1514) 2023-01-10 18:13:25 +09:00