Which lifecycle method to use when component is dependent on two props in React?

Viewed 57

Currently, in our project we are using componentWillReceiveProps method to process props.

componentWillReceiveProps(nextprops) {
   if(nextprops.userData != this.props.userData) {
      //...do something
   }
}

Now, the issue here is that some other prop, employeeData is required in conjunction with userData to do something. Is there some way I can do it in here or maybe some other lifecycle method that will aid in doing this?

Edit: I am using class components and cannot use functional components here.

0 Answers
Related