Skip to content

docs: fix duplicate code snippet typo in Zustand selector example (Part 6a)#4284

Open
sahaarnav3 wants to merge 1 commit into
fullstack-hy2020:sourcefrom
sahaarnav3:patch-1
Open

docs: fix duplicate code snippet typo in Zustand selector example (Part 6a)#4284
sahaarnav3 wants to merge 1 commit into
fullstack-hy2020:sourcefrom
sahaarnav3:patch-1

Conversation

@sahaarnav3
Copy link
Copy Markdown

Description

Fixes a copy-paste snippet error in the Zustand state selection documentation section of part6a.md.

Context

The explanatory text states: "When instead writing: ... the component no longer reacts to changes in the counter value". However, the code block directly beneath it mistakenly duplicated the original unoptimized destructuring snippet (const { increment, decrement, zero } = useCounterStore()) from line 359.

Changes Made

Updated lines 365–367 to demonstrate the actual atomic selector pattern intended by the text:

const increment = useCounterStore((state) => state.increment)
const decrement = useCounterStore((state) => state.decrement)
const zero = useCounterStore((state) => state.zero)

### Description
Fixes a copy-paste snippet error in the Zustand state selection documentation section of `part6a.md`. 

### Context
The explanatory text states: *"When instead writing: ... the component no longer reacts to changes in the counter value"*. However, the code block directly beneath it mistakenly duplicated the original unoptimized destructuring snippet (`const { increment, decrement, zero } = useCounterStore()`) from line 359.

### Changes Made
Updated lines 365–367 to demonstrate the actual atomic selector pattern intended by the text:
```js
const increment = useCounterStore((state) => state.increment)
const decrement = useCounterStore((state) => state.decrement)
const zero = useCounterStore((state) => state.zero)
```
@sahaarnav3 sahaarnav3 changed the title docs: fix duplicate code snippet typo in Zustand selector example docs: fix duplicate code snippet typo in Zustand selector example (Part 6a) May 15, 2026
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.

1 participant