react component use effect code example
Example 1: react hooks
const [state, setState] = useState(initialState);
Example 2: react hooks
componentDidUpdate(prevProps, prevState) {
if (prevState.count !== this.state.count) {
document.title = `You clicked ${this.state.count} times`;
}
}