Browse Source

Update `React.PureComponent` reference.

Maybe I'm somehow weird, but I lived for some time with an idea that `React.Component` does implement `shouldComponentUpdate` with deep comparison. `React.PureComponent` is faster because it compares shallowly.

The changes I propose should avoid this "implicit" kind of way of thinking, since it would explicitly state that `React.Component` does not compare anything.
main
Szymon Nowicki 7 years ago
committed by GitHub
parent
commit
ee1f416790
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      content/docs/reference-react.md

4
content/docs/reference-react.md

@ -71,9 +71,9 @@ See the [React.Component API Reference](/docs/react-component.html) for a list o
### `React.PureComponent`
`React.PureComponent` is exactly like [`React.Component`](#reactcomponent), but implements [`shouldComponentUpdate()`](/docs/react-component.html#shouldcomponentupdate) with a shallow prop and state comparison.
`React.PureComponent` is exactly like [`React.Component`](#reactcomponent), but implements [`shouldComponentUpdate()`](/docs/react-component.html#shouldcomponentupdate) with a shallow prop and state comparison, which [`React.Component`](#reactcomponent) is missing completely.
If your React component's `render()` function renders the same result given the same props and state, you can use `React.PureComponent` for a performance boost in some cases.
If your React component's `render()` function renders the same result given the same props and state, you can use `React.PureComponent` for a performance boost in some cases.
> Note
>

Loading…
Cancel
Save