Skip to content

Commit 44486e9

Browse files
authored
Remove unnecessary memoization from a code example (#4803)
1 parent dd97168 commit 44486e9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

docs/usage/deriving-data-selectors.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const brokenSelector = createSelector(
228228
Similarly, a memoized selector should _never_ use `state => state` as an input! That will force the selector to always recalculate.
229229
:::
230230

231-
In typical Reselect usage, you write your top-level "input selectors" as plain functions, and use `createSelector` to create memoized selectors that look up nested values:
231+
In typical Reselect usage, you write your top-level "input selectors" as plain functions, and use `createSelector` to create memoized selectors that calculate derived values:
232232

233233
```js
234234
const state = {
@@ -238,11 +238,9 @@ const state = {
238238
b: 10
239239
}
240240

241-
const selectA = state => state.a
241+
const selectA1 = state => state.a.first
242242
const selectB = state => state.b
243243

244-
const selectA1 = createSelector([selectA], a => a.first)
245-
246244
const selectResult = createSelector([selectA1, selectB], (a1, b) => {
247245
console.log('Output selector running')
248246
return a1 + b

0 commit comments

Comments
 (0)