DEV Community

FatimaAlam1234
FatimaAlam1234

Posted on

React Pure Components

Pure Functions

  1. Same input -> Same output. Returns the same output when the same input 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 - Manually add shouldComponentUpdate
Reat.PureComponent - Internally calls shouldComponentUpdate
Pure component helps to improve performance.

Top comments (0)