docs: fix the usage error of setPosition (#3100)

This commit is contained in:
Luke 2025-04-29 12:06:03 +08:00 committed by GitHub
parent 67673947d6
commit bd58db0faf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -386,7 +386,7 @@ type PositionStore = PositionStoreState & PositionStoreActions
const usePositionStore = createWithEqualityFn<PositionStore>()(
(set) => ({
position: { x: 0, y: 0 },
setPosition: (nextPosition) => set(nextPosition),
setPosition: (nextPosition) => set({ position: nextPosition }),
}),
shallow,
)

View File

@ -187,7 +187,7 @@ type PositionStore = PositionStoreState & PositionStoreActions
const usePositionStore = create<PositionStore>()((set) => ({
position: { x: 0, y: 0 },
setPosition: (nextPosition) => set(nextPosition),
setPosition: (nextPosition) => set({ position: nextPosition }),
}))
export default function MovingDot() {
@ -361,7 +361,7 @@ type PositionStore = PositionStoreState & PositionStoreActions
const usePositionStore = create<PositionStore>()((set) => ({
position: { x: 0, y: 0 },
setPosition: (nextPosition) => set(nextPosition),
setPosition: (nextPosition) => set({ position: nextPosition }),
}))
export default function MovingDot() {