react top-level 翻译

React.Component

React.PureComponent

React.PureComponent is similar to React.Component. The difference between them is that React.Component doesn’t implement shouldComponentUpdate(), but React.PureComponent implements it with a shallow prop and state comparison.

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.
PureComponent和Component比较类似,唯一不同的就是PureComponent会调用shouldComponentUpdate()
如果render()是纯函数,则可以考虑使用PureComponent来提高性能

你可能感兴趣的:(react top-level 翻译)