create react hook with state code example
Example 1: usestate react
function Example(props) {
// You can use Hooks here!
return <div />;
}
Example 2: react hooks
componentDidUpdate(prevProps, prevState) {
if (prevState.count !== this.state.count) {
document.title = `You clicked ${this.state.count} times`;
}
}