Discussion React.js

React – Prevent Render when Props and State change

When we change the state or props of the component, render method is called by default.

In order to prevent this behavior, we can use shouldComponentUpdate method.

If we return false from this method, render is not called.

This method receives props and state as parameter so we can check if certain state or props value is changed and then return false to prevent render.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *