DEV Community

Fatima Alam
Fatima Alam

Posted on • Edited on

React Pure Components

Pure Functions

  1. Same input -> Same output. Returns the same output when the same input(props) is provided to the function.
  2. No changes are made to any objects or variables that were created before the function was called.

Pure Components
React.Component - Have to manually add shouldComponentUpdate
Reat.PureComponent - Internally calls shouldComponentUpdate
Pure component helps to improve performance.

Top comments (0)