Fix README internal links for GitHub rendering (#3403)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* Initial plan * Fix docs index links Co-authored-by: dbritto-dev <1697714+dbritto-dev@users.noreply.github.com> * Make docs links GitHub friendly Co-authored-by: dbritto-dev <1697714+dbritto-dev@users.noreply.github.com> * Move docs assets to root and update paths Co-authored-by: dbritto-dev <1697714+dbritto-dev@users.noreply.github.com> * Update image source for Zustand logo * Fix docs internal links for GitHub Co-authored-by: dbritto-dev <1697714+dbritto-dev@users.noreply.github.com> * Make docs hero links GitHub friendly Co-authored-by: dbritto-dev <1697714+dbritto-dev@users.noreply.github.com> * Fix image path for Zustand logo in introduction.md * Update image source path in README.md * Delete docs/public directory * Fix README links for GitHub view Co-authored-by: dbritto-dev <1697714+dbritto-dev@users.noreply.github.com> ---------
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
- Co-authored-by: dbritto-dev <1697714+dbritto-dev@users.noreply.github.com>
- Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>
Diff stats
10 files+52 added−52 removed
- other:+52 added−52 removed
Provenance
- Commit
da381c3- Tree
b23f406- Author
Copilot <198982749+Copilot@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
0d250b3
10 files changed+52 added−52 removed
modified:.github/workflows/docs.yml+2 added-2 removed
15 unmodified lines16171819202120212223242515 unmodified lines15 unmodified lines with: mdx: 'docs' libname: 'Zustand' home_redirect: '/learn/getting-started/introduction' icon: '/public/favicon.ico' logo: '/public/bear.jpg' icon: '/favicon.ico' logo: '/bear.jpg' github: 'https://github.com/pmndrs/zustand'
deploy: needs: build15 unmodified linesmodified:docs/learn/getting-started/introduction.md+1 added-1 removed
3 unmodified lines456788910111260 unmodified lines3 unmodified linesnav: 1---
<div class="flex justify-center mb-4"> <img src="/public/bear.jpg" alt="Logo Zustand" /><img src="../../bear.jpg" alt="Logo Zustand" /></div>
A small, fast, and scalable bearbones state management solution.Zustand has a comfy API based on hooks.60 unmodified linesmodified:docs/learn/index.md+20 added-20 removed
5 unmodified lines678910111210111213141516171819202122181920212223242526272829302829303132333435363738363738394041424344454644454647484950515253545253545 unmodified lines## Start here
If you are new to Zustand, begin here for installation, a high-level overview, and a hands-on tutorial.
- [Introduction](/learn/getting-started/introduction.md) — Install Zustand and create your first store.- [Comparison with other tools](/learn/getting-started/comparison.md) — See how Zustand compares to Redux, Jotai, Recoil, and others.- [Tutorial: Tic Tac Toe](/learn/guides/tutorial-tic-tac-toe.md) — Build a complete game to learn Zustand concepts step by step.- [Introduction](./getting-started/introduction.md) — Install Zustand and create your first store.- [Comparison with other tools](./getting-started/comparison.md) — See how Zustand compares to Redux, Jotai, Recoil, and others.- [Tutorial: Tic Tac Toe](./guides/tutorial-tic-tac-toe.md) — Build a complete game to learn Zustand concepts step by step.
## Core concepts
The fundamentals of reading and updating state in a Zustand store.
- [Updating state](/learn/guides/updating-state.md) — How to update primitive values, objects, and nested state.- [Practice with no store actions](/learn/guides/practice-with-no-store-actions.md) — Define state updates outside the store for simpler patterns.- [Slices pattern](/learn/guides/slices-pattern.md) — Split a large store into smaller, composable slices.- [Immutable state and merging](/learn/guides/immutable-state-and-merging.md) — Understand how Zustand merges state and when to spread manually.- [Maps and sets usage](/learn/guides/maps-and-sets-usage.md) — Work with `Map` and `Set` inside Zustand state correctly.- [Updating state](./guides/updating-state.md) — How to update primitive values, objects, and nested state.- [Practice with no store actions](./guides/practice-with-no-store-actions.md) — Define state updates outside the store for simpler patterns.- [Slices pattern](./guides/slices-pattern.md) — Split a large store into smaller, composable slices.- [Immutable state and merging](./guides/immutable-state-and-merging.md) — Understand how Zustand merges state and when to spread manually.- [Maps and sets usage](./guides/maps-and-sets-usage.md) — Work with `Map` and `Set` inside Zustand state correctly.
## Performance and rendering
Techniques for keeping re-renders minimal and components fast.
- [Prevent rerenders with useShallow](/learn/guides/prevent-rerenders-with-use-shallow.md) — Use shallow comparison to avoid unnecessary re-renders when selecting objects.- [Connect to state with URL hash](/learn/guides/connect-to-state-with-url-hash.md) — Sync store state with the URL hash for shareable UI state.- [Event handler in pre React 18](/learn/guides/event-handler-in-pre-react-18.md) — Handle the batching edge case in React 17 and earlier.- [Prevent rerenders with useShallow](./guides/prevent-rerenders-with-use-shallow.md) — Use shallow comparison to avoid unnecessary re-renders when selecting objects.- [Connect to state with URL hash](./guides/connect-to-state-with-url-hash.md) — Sync store state with the URL hash for shareable UI state.- [Event handler in pre React 18](./guides/event-handler-in-pre-react-18.md) — Handle the batching edge case in React 17 and earlier.
## TypeScript path
Guides for typing stores, actions, and selectors with TypeScript.
- [Beginner TypeScript](/learn/guides/beginner-typescript.md) — Type a basic store with state and actions.- [Advanced TypeScript](/learn/guides/advanced-typescript.md) — Type slices, middleware stacks, and complex patterns.- [Auto-generating selectors](/learn/guides/auto-generating-selectors.md) — Generate typed selectors automatically from a store definition.- [Beginner TypeScript](./guides/beginner-typescript.md) — Type a basic store with state and actions.- [Advanced TypeScript](./guides/advanced-typescript.md) — Type slices, middleware stacks, and complex patterns.- [Auto-generating selectors](./guides/auto-generating-selectors.md) — Generate typed selectors automatically from a store definition.
## Frameworks and platforms
Using Zustand in server-rendered and framework-specific environments.
- [Next.js](/learn/guides/nextjs.md) — Set up Zustand in a Next.js app with proper SSR handling.- [SSR and hydration](/learn/guides/ssr-and-hydration.md) — Avoid hydration mismatches when rendering on the server.- [Initialize state with props](/learn/guides/initialize-state-with-props.md) — Seed a store's initial state from React component props.- [Next.js](./guides/nextjs.md) — Set up Zustand in a Next.js app with proper SSR handling.- [SSR and hydration](./guides/ssr-and-hydration.md) — Avoid hydration mismatches when rendering on the server.- [Initialize state with props](./guides/initialize-state-with-props.md) — Seed a store's initial state from React component props.
## Testing and quality
Best practices for writing reliable, maintainable code with Zustand.
- [Testing stores and components](/learn/guides/testing.md) — Test store logic and React components that consume a store.- [Flux-inspired practice](/learn/guides/flux-inspired-practice.md) — Apply Flux conventions to keep state changes predictable.- [How to reset state](/learn/guides/how-to-reset-state.md) — Reset a store back to its initial state on demand.- [Testing stores and components](./guides/testing.md) — Test store logic and React components that consume a store.- [Flux-inspired practice](./guides/flux-inspired-practice.md) — Apply Flux conventions to keep state changes predictable.- [How to reset state](./guides/how-to-reset-state.md) — Reset a store back to its initial state on demand.deleted:docs/public/bear.jpgbinary
A binary file, deleted.
deleted:docs/public/favicon.icobinary
A binary file, deleted.
modified:docs/reference/index.md+19 added-19 removed
5 unmodified lines6 ## APIs7 8 Core functions for creating and configuring stores.9 10-- [`create`](/reference/apis/create.md) — Create a store bound to React via hooks.11-- [`createStore`](/reference/apis/create-store.md) — Create a standalone store without React.12-- [`createWithEqualityFn`](/reference/apis/create-with-equality-fn.md) — Like `create`, but with a custom equality function.13-- [`shallow`](/reference/apis/shallow.md) — Utility for shallow comparison of objects and arrays.10+- [`create`](./apis/create.md) — Create a store bound to React via hooks.11+- [`createStore`](./apis/create-store.md) — Create a standalone store without React.12+- [`createWithEqualityFn`](./apis/create-with-equality-fn.md) — Like `create`, but with a custom equality function.13+- [`shallow`](./apis/shallow.md) — Utility for shallow comparison of objects and arrays.14 15 ## Hooks16 17 React hooks for reading and subscribing to store state.18 19-- [`useStore`](/reference/hooks/use-store.md) — Access and subscribe to a vanilla store from a React component.20-- [`useStoreWithEqualityFn`](/reference/hooks/use-store-with-equality-fn.md) — Like `useStore`, but with a custom equality function.21-- [`useShallow`](/reference/hooks/use-shallow.md) — Derive a stable reference from a selector using shallow comparison.19+- [`useStore`](./hooks/use-store.md) — Access and subscribe to a vanilla store from a React component.20+- [`useStoreWithEqualityFn`](./hooks/use-store-with-equality-fn.md) — Like `useStore`, but with a custom equality function.21+- [`useShallow`](./hooks/use-shallow.md) — Derive a stable reference from a selector using shallow comparison.22 23 ## Middlewares24 25 Composable middleware functions for extending store behavior.26 27-- [`persist`](/reference/middlewares/persist.md) — Persist and rehydrate state using `localStorage` or a custom storage engine.28-- [`devtools`](/reference/middlewares/devtools.md) — Connect a store to Redux DevTools for time-travel debugging.29-- [`redux`](/reference/middlewares/redux.md) — Use a reducer and dispatch pattern similar to Redux.30-- [`immer`](/reference/middlewares/immer.md) — Write state updates with mutable syntax using Immer.31-- [`combine`](/reference/middlewares/combine.md) — Combine separate state slices into a single store with inferred types.32-- [`subscribeWithSelector`](/reference/middlewares/subscribe-with-selector.md) — Subscribe to a slice of state with selector and equality support.27+- [`persist`](./middlewares/persist.md) — Persist and rehydrate state using `localStorage` or a custom storage engine.28+- [`devtools`](./middlewares/devtools.md) — Connect a store to Redux DevTools for time-travel debugging.29+- [`redux`](./middlewares/redux.md) — Use a reducer and dispatch pattern similar to Redux.30+- [`immer`](./middlewares/immer.md) — Write state updates with mutable syntax using Immer.31+- [`combine`](./middlewares/combine.md) — Combine separate state slices into a single store with inferred types.32+- [`subscribeWithSelector`](./middlewares/subscribe-with-selector.md) — Subscribe to a slice of state with selector and equality support.33 34 ## Integrations35 36 In-depth guides for using Zustand alongside third-party libraries.37 38-- [Persisting store data](/reference/integrations/persisting-store-data.md) — Detailed guide to the `persist` middleware and storage adapters.39-- [Immer middleware](/reference/integrations/immer-middleware.md) — Detailed guide to the `immer` middleware.40-- [Third-party libraries](/reference/integrations/third-party-libraries.md) — Using Zustand with other libraries in the ecosystem.38+- [Persisting store data](./integrations/persisting-store-data.md) — Detailed guide to the `persist` middleware and storage adapters.39+- [Immer middleware](./integrations/immer-middleware.md) — Detailed guide to the `immer` middleware.40+- [Third-party libraries](./integrations/third-party-libraries.md) — Using Zustand with other libraries in the ecosystem.41 42 ## Migrations43 44 Upgrade guides between major versions.45 46-- [Migrating to v5](/reference/migrations/migrating-to-v5.md) — How to upgrade from Zustand v4.47-- [Migrating to v4](/reference/migrations/migrating-to-v4.md) — How to upgrade from Zustand v3.46+- [Migrating to v5](./migrations/migrating-to-v5.md) — How to upgrade from Zustand v4.47+- [Migrating to v4](./migrations/migrating-to-v4.md) — How to upgrade from Zustand v3.48 49 ## Previous versions50 51 APIs that existed in older versions of Zustand and are no longer recommended for new code.52 53-- [createContext (v3)](/reference/previous-versions/zustand-v3-create-context.md) — The `createContext` export from `zustand/context`, deprecated in v4 and removed in v5.53+- [createContext (v3)](./previous-versions/zustand-v3-create-context.md) — The `createContext` export from `zustand/context`, deprecated in v4 and removed in v5.added:docs/bear.jpgbinary
A binary file, added.
added:docs/favicon.icobinary
A binary file, added.
modified:docs/index.md+7 added-7 removed
2 unmodified lines345678910111213789101112131415161710 unmodified lines2 unmodified lines
hero: text: Bear necessities for React state tagline: A tiny, predictable store with hooks-first ergonomics and escape hatches that stay out of your way. actions: - theme: brand text: Introduction link: /getting-started/introduction - theme: alt text: Quick Start link: /learn/ actions: - theme: brand text: Introduction link: ./learn/getting-started/introduction.md - theme: alt text: Quick Start link: ./learn/index.mdfeatures: - title: Minimal API, fast adoption details: Create a store with a single hook, subscribe with selectors, and avoid boilerplate or providers. - title: Safe under React concurrency10 unmodified linesmodified:README.md+3 added-3 removed
1 <p align="center">2- <img src="docs/public/bear.jpg" />2+ <img src="./docs/bear.jpg" />3 </p>4 5 [](https://github.com/pmndrs/zustand/actions?query=workflow%3ATest)6 [](https://bundlejs.com/?q=zustand)493 unmodified lines500 - You may wonder how to organize your code for better maintenance: [Splitting the store into separate slices](./docs/learn/guides/slices-pattern.md).501 - Recommended usage for this unopinionated library: [Flux inspired practice](./docs/learn/guides/flux-inspired-practice.md).502 - [Calling actions outside a React event handler in pre-React 18](./docs/learn/guides/event-handler-in-pre-react-18.md).503 - [Testing](./docs/learn/guides/testing.md)504-- For more, have a look [in the docs folder](./docs/)504+- For more, have a look [in the docs folder](./docs/index.md)505 506 ## Third-Party Libraries507 508-Some users may want to extend Zustand's feature set which can be done using third-party libraries made by the community. For information regarding third-party libraries with Zustand, visit [the doc](./docs/integrations/third-party-libraries.md).508+Some users may want to extend Zustand's feature set which can be done using third-party libraries made by the community. For information regarding third-party libraries with Zustand, visit [the doc](./docs/reference/integrations/third-party-libraries.md).509 510 ## Comparison with other libraries511 512 - [Difference between zustand and other state management libraries for React](https://zustand.docs.pmnd.rs/getting-started/comparison)