react hook list code example
Example 1: reference hook in react
import React, {useRef} from 'react'
const displayNode = useRef(null)
displayNode.current.textContent = `${count} Appointments Successfully Uploaded`
<div ref={displayNode} className="text-center mt-3 msg" style={{ color: "green", fontWeight: "800" }}></div>
Example 2: react hooks
import React, { useState } from 'react';
function Example() {
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);
}
Example 3: react hooks
componentDidUpdate(prevProps, prevState) {
if (prevState.count !== this.state.count) {
document.title = `You clicked ${this.state.count} times`;
}
}