Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to select a dom element in react

function App() {
    const elementVariable = useRef(null)
    useEffect(() => console.log(elementVariable), [] )
    return (
        <div ref={elementVariable}>
           <h1></h1> 
        </div>
    )
}
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #select #dom #element #react
ADD COMMENT
Topic
Name
8+9 =