Skip to content

docs(updating-state): use curried create form with explicit state type#3503

Merged
dbritto-dev merged 1 commit into
pmndrs:mainfrom
TheSeydiCharyyev:docs/updating-state-curried-create
May 20, 2026
Merged

docs(updating-state): use curried create form with explicit state type#3503
dbritto-dev merged 1 commit into
pmndrs:mainfrom
TheSeydiCharyyev:docs/updating-state-curried-create

Conversation

@TheSeydiCharyyev

Copy link
Copy Markdown
Contributor

updating-state.md creates a typed store with the non-curried create<T>(...) form:

const usePersonStore = create<State & Action>((set) => ({

When the state type is annotated explicitly, Zustand's own TypeScript guides require the curried form create<T>()(...):

  • Advanced TypeScript Guide: "instead of writing create(...), you have to write create<T>()(...) (notice the extra parentheses () too along with the type parameter)".
  • Beginner TypeScript Guide: the store example uses create<BearState>()((set) => ...).

Every other example across the docs that annotates the state type uses the curried form — this guide is the only one that doesn't, which is misleading since updating-state.md is one of the first guides a beginner reads.

Diff

- const usePersonStore = create<State & Action>((set) => ({
+ const usePersonStore = create<State & Action>()((set) => ({

Docs-only change — no changeset needed.

@vercel

vercel Bot commented May 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zustand-demo Ready Ready Preview, Comment May 20, 2026 10:25am

Request Review

@codesandbox-ci

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@pkg-pr-new

pkg-pr-new Bot commented May 20, 2026

Copy link
Copy Markdown

commit: 7a78ceb

@dbritto-dev
dbritto-dev merged commit 038b938 into pmndrs:main May 20, 2026
33 checks passed
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 this pull request may close these issues.

2 participants