DEV Community

Discussion on: ReactJS -- If it is setting a state with the same value, will the component be re-rendered?

Collapse
 
wolverineks profile image
Kevin Sullivan • Edited

If you extend the class component from React.PureComponent it will do a shallow comparison on props and state to determine if it should rerender.

That being said, doing this is usually slower than allowing the component to rerender.