1import React, { useEffect, useRef } from "react";
2
3const MyComponent = () => {
4 const myContainer = useRef(null);
5
6 useEffect(() => {
7 console.log("myContainer..", myContainer.current);
8 });
9
10 return (
11 <>
12 <h1>Ref with react</h1>
13 <div ref={myContainer}>I can use the DOM with react ref</div>
14 </>
15 );
16};
17
18export default MyComponent;
19