-
Is it generally recommended to memoize all selectors? Seems like a premature optimisation for the most part? If it's not a premature optimization seems like a major omission to exclude factories from the zustand library. Will it be death by a thousand cuts? If most of the time it is a premature optimisation, under what circumstances is it advised? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That section is introduced in v3, because at that time we were expecting Now, we will have |
Beta Was this translation helpful? Give feedback.
That section is introduced in v3, because at that time we were expecting
useMutableSource
which would require memoized selectors (without stable selectors, it caused infinite loop). #422Now, we will have
useSyncExternalStore
instead and memoized selectors are not necessary. That section is removed in v4. #550 (Hmm, we can remove it now, but v4 will probably be released any time soon.)