From 92655f535e00d9f740a3e08bb525c28849248780 Mon Sep 17 00:00:00 2001 From: "Mucahid E." <127043807+MucahidTech@users.noreply.github.com> Date: Wed, 22 Jul 2026 14:43:41 +0300 Subject: [PATCH] Part 6a: fix contradiction in Zustand selectors example Fixed a contradiction code snippet where destructuring was repeated instead of showing individual selectors. --- src/content/6/en/part6a.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/6/en/part6a.md b/src/content/6/en/part6a.md index 33df1dc6db3..4d0c0d899a5 100644 --- a/src/content/6/en/part6a.md +++ b/src/content/6/en/part6a.md @@ -363,7 +363,9 @@ The solution works, but it has a significant drawback. Destructuring causes the The best practice in Zustand is therefore to select from the state exactly only those parts that are needed in the given component. A component re-renders only when the part of the state it has selected changes. When instead writing: ```js - const { increment, decrement, zero } = useCounterStore() + const increment = useCounterStore((state) => state.increment) + const decrement = useCounterStore((state) => state.decrement) + const zero = useCounterStore((state) => state.zero) ``` the component no longer reacts to changes in the counter value, because it has not selected it from the state.