Skip to content

Commit

Permalink
Fix broken link to cache docs
Browse files Browse the repository at this point in the history
  • Loading branch information
toomuchdesign committed Jun 21, 2019
1 parent 3422d90 commit 9e8ff8f
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

Useful to:

- **retain selector's cache** when sequentially **called with one/few different arguments** ([example][example-1])
- **join similar selectors** into one
- **share selectors** with props across multiple component instances (see [reselect example][reselect-sharing-selectors] and [re-reselect solution][example-2])
- **instantiate** selectors **on runtime**
- **Retain selector's cache** when sequentially **called with one/few different arguments** ([example][example-1])
- **Join similar selectors** into one
- **Share selectors** with props across multiple component instances (see [reselect example][reselect-sharing-selectors] and [re-reselect solution][example-2])
- **Instantiate** selectors **on runtime**
- Enhance `reselect` with [custom caching strategies][cache-objects-docs]

<!-- prettier-ignore -->
```js
Expand Down Expand Up @@ -235,7 +236,7 @@ createCachedSelector(

### How do I limit the cache size?

Use a `cacheObject` which provides that feature by supplying a [`cacheObject` option](#options).
Use a [`cacheObject`][cache-objects-docs] which provides that feature by supplying a [`cacheObject` option](#options).

You can also write **your own cache strategy**!

Expand Down Expand Up @@ -334,33 +335,33 @@ createStructuredCachedSelector(

**Returns** a [selector instance][selector-instance-docs].

### `keySelector`
### keySelector

`keySelector` is a custom function receiving the same arguments as your selectors (and `inputSelectors`) and **returning a `cacheKey`**.
A custom function receiving the same arguments as your selectors (and `inputSelectors`) and **returning a `cacheKey`**.

`cacheKey` is **by default a `string` or `number`** but can be anything depending on the chosen cache strategy (see [`cacheObject` option](#optionscacheobject)).

The `keySelector` idea comes from [Lodash's .memoize][lodash-memoize].

### `options`
### options

`options` is an optional object with the following properties:
#### cacheObject

#### `cacheObject`
Type: `object`<br />
Default: [`FlatObjectCache`][cache-objects-docs]

Default: `FlatObjectCache`
An optional custom **cache strategy object** to handle the caching behaviour. Read more about [re-reselect's custom cache here][cache-objects-docs].

An optional custom **cache strategy object** to handle the caching behaviour.
#### selectorCreator

Read more about [re-reselect's custom cache here](cache-objects-docs).
Type: `function`<br />
Default: `reselect`'s [`createSelector`][reselect-create-selector]

#### `selectorCreator`
An optional function describing a [custom version of createSelector][reselect-create-selector-creator].

An optional function describing a [custom selectors][reselect-create-selector-creator]. By default it uses `reselect`'s `createSelector`.
### re-reselect selector instance

### Selector instance

A selector function providing the same API as a **standard reselect selectors**.
`createCachedSelector` and `createStructuredCachedSelector` return a **selector instance** which extends the API of a **standard reselect selector**.

> The followings are advanced methods and you won't need them for basic usage!
Expand Down Expand Up @@ -446,6 +447,6 @@ Thanks to you all ([emoji key][docs-all-contributors]):
[example-1]: examples/1-join-selectors.md
[example-2]: examples/2-avoid-selector-factories.md
[example-3]: examples/3-cache-api-calls.md
[selector-instance-docs]: #selector-instance
[selector-instance-docs]: #re-reselect-selector-instance
[cache-objects-docs]: src/cache#readme
[docs-all-contributors]: https://github.com/kentcdodds/all-contributors#emoji-key

0 comments on commit 9e8ff8f

Please sign in to comment.