Skip to content

Commit

Permalink
fix link
Browse files Browse the repository at this point in the history
  • Loading branch information
mfbx9da4 committed May 11, 2021
1 parent f68aa3b commit f174fe4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions website/docs/docs/api/computed.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,18 @@ function Todo({ id }) {
Note that only the function that you return will be memoized. If you wish to
memoize the results from the function itself you will need to utilize a
memoization utility, such as
[`memoizerific`](https://github.com/caiogondim/fast-memoize.js).
[`memoizerific`](https://github.com/thinkloop/memoizerific).

```javascript
import memoize from 'memoizerific';

const memoizedFind = memoize((state, id) => state.items.find((todo) => todo.id === id), 1)

const todos = {
items: [{ id: 1, text: 'answer questions' }],

todoById: computed((state) => {
// Wrap the returned function with the memoize utility
// 👇
return (id) => memoizedFind(state, id);
return memoize((id) => state.items.find((todo) => todo.id === id), 1);
}),
};
```
Expand Down

0 comments on commit f174fe4

Please sign in to comment.