docs: fix typo (#1969)

This commit is contained in:
Juhyeok Kang 2023-08-03 08:40:20 +09:00 committed by GitHub
parent 2778e71c84
commit 19d3df22a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,7 @@ Here's the diff showing how to migrate from v3 createContext to v4 API.
+ import { createStore, useStore } from "zustand";
- const useStore = create((set) => ({
+ const store = createStore((set) => ({
+ const store = createStore((set) => ({
bears: 0,
increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),
removeAllBears: () => set({ bears: 0 })
@ -125,7 +125,7 @@ Here's the diff showing how to migrate from v3 createContext to v4 API.
+ const MyContext = createContext()
+ export const Provider = ({ children }) = <MyContext.Provider value={store}>{children}</MyContext.Provider>;
+ export const Provider = ({ children }) => <MyContext.Provider value={store}>{children}</MyContext.Provider>;
+ export const useMyStore = (selector) => useStore(useContext(MyContext), selector);
```