mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
Fix "previous" and "next" navigation links (#2777)
This commit is contained in:
parent
717f569022
commit
eac9dad35b
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: createStore
|
||||
description: How to create vanilla stores
|
||||
nav: 202
|
||||
nav: 24
|
||||
---
|
||||
|
||||
`createStore` lets you create a vanilla store that exposes API utilities.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: createWithEqualityFn ⚛️
|
||||
description: How to create efficient stores
|
||||
nav: 203
|
||||
nav: 25
|
||||
---
|
||||
|
||||
`createWithEqualityFn` lets you create a React Hook with API utilities attached, just like `create`.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: create ⚛️
|
||||
description: How to create stores
|
||||
nav: 204
|
||||
nav: 26
|
||||
---
|
||||
|
||||
`create` lets you create a React Hook with API utilities attached.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: shallow
|
||||
description: How compare simple data effectively
|
||||
nav: 209
|
||||
nav: 27
|
||||
---
|
||||
|
||||
`shallow` lets you run fast checks on simple data structures. It effectively identifies changes in
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Auto Generating Selectors
|
||||
nav: 6
|
||||
nav: 5
|
||||
---
|
||||
|
||||
We recommend using selectors when using either the properties or actions from the store. You can access values from the store like so:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Connect to state with URL
|
||||
nav: 12
|
||||
nav: 11
|
||||
---
|
||||
|
||||
## Connect State with URL Hash
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Calling actions outside a React event handler in pre React 18
|
||||
nav: 10
|
||||
nav: 9
|
||||
---
|
||||
|
||||
Because React handles `setState` synchronously if it's called outside an event handler, updating the state outside an event handler will force react to update the components synchronously. Therefore, there is a risk of encountering the zombie-child effect.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Flux inspired practice
|
||||
nav: 5
|
||||
nav: 4
|
||||
---
|
||||
|
||||
Although Zustand is an unopinionated library, we do recommend a few patterns.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: How to reset state
|
||||
nav: 13
|
||||
nav: 12
|
||||
---
|
||||
|
||||
The following pattern can be used to reset the state to its initial value.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Immutable state and merging
|
||||
nav: 4
|
||||
nav: 3
|
||||
---
|
||||
|
||||
Like with React's `useState`, we need to update state immutably.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Initialize state with props
|
||||
nav: 14
|
||||
nav: 13
|
||||
---
|
||||
|
||||
In cases where [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) is needed, such as when a store should be initialized with props from a component, the recommended approach is to use a vanilla store with React.context.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Map and Set Usage
|
||||
nav: 11
|
||||
nav: 10
|
||||
---
|
||||
|
||||
You need to wrap Maps and Sets inside an object. When you want its update to be reflected (e.g. in React),
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Setup with Next.js
|
||||
nav: 21
|
||||
nav: 17
|
||||
---
|
||||
|
||||
[Next.js](https://nextjs.org) is a popular server-side rendering framework for React that presents
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Practice with no store actions
|
||||
nav: 7
|
||||
nav: 6
|
||||
---
|
||||
|
||||
The recommended usage is to colocate actions and states within the store (let your actions be located together with your state).
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Prevent rerenders with useShallow
|
||||
nav: 16
|
||||
nav: 15
|
||||
---
|
||||
|
||||
When you need to subscribe to a computed state from a store, the recommended way is to
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Slices Pattern
|
||||
nav: 15
|
||||
nav: 14
|
||||
---
|
||||
|
||||
## Slicing the store into smaller stores
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: SSR and Hydration
|
||||
nav: 20
|
||||
nav: 16
|
||||
---
|
||||
|
||||
## Server-side Rendering (SSR)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Testing
|
||||
description: Writing Tests
|
||||
nav: 9
|
||||
nav: 8
|
||||
---
|
||||
|
||||
## Setting Up a Test Environment
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: TypeScript Guide
|
||||
nav: 8
|
||||
nav: 7
|
||||
---
|
||||
|
||||
## Basic usage
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Updating state
|
||||
nav: 3
|
||||
nav: 2
|
||||
---
|
||||
|
||||
## Flat updates
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: useShallow ⚛️
|
||||
description: How to memoize selector functions
|
||||
nav: 211
|
||||
nav: 28
|
||||
---
|
||||
|
||||
`useShallow` is a React Hook that lets you optimize re-renders.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: useStoreWithEqualityFn ⚛️
|
||||
description: How to use vanilla stores effectively in React
|
||||
nav: 212
|
||||
nav: 29
|
||||
---
|
||||
|
||||
`useStoreWithEqualityFn` is a React Hook that lets you use a vanilla store in React, just like
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: useStore ⚛️
|
||||
description: How to use vanilla stores in React
|
||||
nav: 213
|
||||
nav: 30
|
||||
---
|
||||
|
||||
`useStore` is a React Hook that lets you use a vanilla store in React.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Immer middleware
|
||||
nav: 16
|
||||
nav: 18
|
||||
---
|
||||
|
||||
The [Immer](https://github.com/immerjs/immer) middleware enables you
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Persisting store data
|
||||
nav: 17
|
||||
nav: 20
|
||||
---
|
||||
|
||||
The Persist middleware enables you to store
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Third-party Libraries
|
||||
nav: 16
|
||||
nav: 19
|
||||
---
|
||||
|
||||
Zustand provides bear necessities for state management.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Migrating to v4
|
||||
nav: 19
|
||||
nav: 22
|
||||
---
|
||||
|
||||
The only breaking changes are in types.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 'How to Migrate to v5 from v4'
|
||||
nav: 30
|
||||
nav: 23
|
||||
---
|
||||
|
||||
# How to Migrate to v5 from v4
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: createContext from zustand/context
|
||||
nav: 18
|
||||
nav: 21
|
||||
---
|
||||
|
||||
A special `createContext` is provided since v3.5,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user