Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

prev props

componentDidUpdate(prevProps) {
  // Utilisation classique (pensez bien à comparer les props) :
  if (this.props.userID !== prevProps.userID) {
    this.fetchData(this.props.userID);
  }
}
Source by fr.reactjs.org #
 
PREVIOUS NEXT
Tagged: #prev #props
ADD COMMENT
Topic
Name
6+3 =