Skip to content

Commit 92d16de

Browse files
authored
Merge pull request #285 from L-u-k-e/master
Update docs
2 parents fef418e + eeb242b commit 92d16de

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ console.log(totalSelector(exampleState)) // { total: 2.322 }
5656
- [Composing Selectors](#composing-selectors)
5757
- [Connecting a Selector to the Redux Store](#connecting-a-selector-to-the-redux-store)
5858
- [Accessing React Props in Selectors](#accessing-react-props-in-selectors)
59-
- [Sharing Selectors with Props Across Multiple Components](#sharing-selectors-with-props-across-multiple-components)
59+
- [Sharing Selectors with Props Across Multiple Component Instances](#sharing-selectors-with-props-across-multiple-component-instances)
6060
- [API](#api)
6161
- [`createSelector`](#createselectorinputselectors--inputselectors-resultfunc)
6262
- [`defaultMemoize`](#defaultmemoizefunc-equalitycheck--defaultequalitycheck)
@@ -70,7 +70,7 @@ console.log(totalSelector(exampleState)) // { total: 2.322 }
7070
- [How do I test a selector?](#q-how-do-i-test-a-selector)
7171
- [How do I create a selector that takes an argument? ](#q-how-do-i-create-a-selector-that-takes-an-argument)
7272
- [How do I use Reselect with Immutable.js?](#q-how-do-i-use-reselect-with-immutablejs)
73-
- [Can I share a selector across multiple components?](#q-can-i-share-a-selector-across-multiple-components)
73+
- [Can I share a selector across multiple component instances?](#q-can-i-share-a-selector-across-multiple-component-instances)
7474
- [Are there TypeScript typings?](#q-are-there-typescript-typings)
7575
- [How can I make a curried selector?](#q-how-can-i-make-a-curried-selector)
7676

@@ -218,7 +218,7 @@ export default VisibleTodoList
218218
219219
So far we have only seen selectors receive the Redux store state as an argument, but a selector can receive props too.
220220

221-
Here is an `App` component that renders three `VisibleTodoList` components, each of which has a `listId` prop:
221+
Here is an `App` component that renders three `VisibleTodoList` component instances, each of which has a `listId` prop:
222222

223223
#### `components/App.js`
224224

@@ -316,13 +316,13 @@ export default VisibleTodoList
316316

317317
A selector created with `createSelector` has a cache size of 1 and only returns the cached value when its set of arguments is the same as its previous set of arguments. If we alternate between rendering `<VisibleTodoList listId="1" />` and `<VisibleTodoList listId="2" />`, the shared selector will alternate between receiving `{listId: 1}` and `{listId: 2}` as its `props` argument. This will cause the arguments to be different on each call, so the selector will always recompute instead of returning the cached value. We’ll see how to overcome this limitation in the next section.
318318

319-
### Sharing Selectors with Props Across Multiple Components
319+
### Sharing Selectors with Props Across Multiple Component Instances
320320

321321
> The examples in this section require React Redux v4.3.0 or greater
322322
323323
> An alternative approach be found in [re-reselect](https://github.com/toomuchdesign/re-reselect)
324324
325-
To share a selector across multiple `VisibleTodoList` components while passing in `props` **and** retaining memoization, each instance of the component needs its own private copy of the selector.
325+
To share a selector across multiple `VisibleTodoList` instances while passing in `props` **and** retaining memoization, each instance of the component needs its own private copy of the selector.
326326

327327
Let’s create a function named `makeGetVisibleTodos` that returns a new copy of the `getVisibleTodos` selector each time it is called:
328328

@@ -930,11 +930,11 @@ assert.notEqual(myMap, newMap)
930930

931931
If a selector's input is updated by an operation that always returns a new object, it may be performing unnecessary recomputations. See [here](#q-why-is-my-selector-recomputing-when-the-input-state-stays-the-same) for a discussion on the pros and cons of using a deep equality check like `Immutable.is` to eliminate unnecessary recomputations.
932932

933-
### Q: Can I share a selector across multiple components?
933+
### Q: Can I share a selector across multiple component instances?
934934

935-
A: Selectors created using `createSelector` only have a cache size of one. This can make them unsuitable for sharing across multiple components if the arguments to the selector are different for each instance of the component. There are a couple of ways to get around this:
935+
A: Selectors created using `createSelector` only have a cache size of one. This can make them unsuitable for sharing across multiple instances if the arguments to the selector are different for each instance of the component. There are a couple of ways to get around this:
936936

937-
* Create a factory function which returns a new selector for each instance of the component. There is built-in support for factory functions in React Redux v4.3 or higher. See [here](#sharing-selectors-with-props-across-multiple-components) for an example.
937+
* Create a factory function which returns a new selector for each instance of the component. There is built-in support for factory functions in React Redux v4.3 or higher. See [here](#sharing-selectors-with-props-across-multiple-component-instances) for an example.
938938

939939
* Create a custom selector with a cache size greater than one.
940940

0 commit comments

Comments
 (0)