Answers for "component did update react"

2

component did update arguments

componentDidUpdate(prevProps, prevState) {
  // only update chart if the data has changed
  if (prevProps.data !== this.props.data) {
    this.chart = c3.load({
      data: this.props.data
    });
  }
}
Posted by: Guest on October-05-2020
1

shouldcomponentupdate

shouldComponentUpdate(nextProps, nextState) {
  return true;
}
Posted by: Guest on June-08-2020
0

prev props

componentDidUpdate(prevProps) {
  // Utilisation classique (pensez bien à comparer les props) :
  if (this.props.userID !== prevProps.userID) {
    this.fetchData(this.props.userID);
  }
}
Posted by: Guest on June-29-2020

Code answers related to "component did update react"

Browse Popular Code Answers by Language