What is PureComponent?

Components are independent and reusable bits of code. We can say that every application you will develop in React will be made up of pieces called components.

Generally, In React js, we use shouldComponentUpdate() Lifecycle method to customize the default behavior and implement it when the React component should re-render or update itself.

React js has provided us a Pure Component. If we extend a class with PureComponent, there is no need for shouldComponentUpdate() Lifecycle Method. React.PureComponent implements it with a shallow prop and state comparison.

React js Pure Component class compares the current state and props with the new props and state to decide whether the React component should re-render itself or not. If the previous value of state and props and the new value of state or props are the same, the component will not re-render itself.

205 thoughts on “What is PureComponent?

  1. Nice post. I learn something totally new and challenging
    on websites I stumbleupon everyday. It will always be interesting to read
    content from other authors and practice a little something from other websites.

  2. Heya i am for the primary time here. I found this board and I
    in finding It really useful & it helped me out much.
    I’m hoping to present one thing again and aid others like you aided me.

  3. I’m curious to find out what blog platform you have been using?
    I’m experiencing some minor security problems with my latest site and I’d like to find
    something more risk-free. Do you have any solutions?

Comments are closed.