Skip to content

Commit

Permalink
Tweak to "areEqual" to match the note below
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Oct 23, 2018
1 parent 21179e9 commit f9da7e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/docs/reference-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ By default it will only shallowly compare complex objects in the props object. I
function MyComponent(props) {
/* render using props */
}
function equals(prevProps, nextProps) {
function areEqual(prevProps, nextProps) {
/*
return true if passing nextProps to render would return
the same result as passing prevProps to render,
otherwise return false
*/
}
export default React.memo(MyComponent, equals);
export default React.memo(MyComponent, areEqual);
```

This method only exists as a **[performance optimization](/docs/optimizing-performance.html).** Do not rely on it to "prevent" a render, as this can lead to bugs.
Expand Down

0 comments on commit f9da7e9

Please sign in to comment.