Answers for "which of the following method is called immediately after the re-render"

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
2

lifecycles if reactjs

class Clock extends React.Component {
  constructor(props) {
    super(props);
    this.state = {date: new Date()};
  }

  componentDidMount() {  }
  componentWillUnmount() {  }
  render() {
    return (
      <div>
        <h1>Hello, world!</h1>
        <h2>It is {this.state.date.toLocaleTimeString()}.</h2>
      </div>
    );
  }
}
Posted by: Guest on July-07-2020

Code answers related to "which of the following method is called immediately after the re-render"

Browse Popular Code Answers by Language