← React Beginner Questions - Set 9 Q85
React Beginner Questions - Set 9
class Data extends Component {
componentDidMount() { this.load(); } // after first render
componentDidUpdate(prev) { if (prev.id !== this.props.id) this.load(); }
componentWillUnmount() { this.abort(); } // cleanup
render() { return null; }
}