hook example react
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`;
}
}