What is the difference between shouldComponentUpdate and componentWillUpdate in React?

Viewed 5376

I have a doubt , when we are using react component methods there are methods with same behavior, and also they are called one by one in the component life cycle ? then what is the major difference,

shouldComponentUpdate(nextProps, nextState){
  // It will be executed with nextProps and nextState
} 
componentWillUpdate(nextProps, nextState){
  // It will be executed first with same data nextProps, nextState
} 

In the above example We have same parameter data with same behavior but the shouldComponentUpdate will be called first.

Then what is the main difference ?

1 Answers
Related