FEATURE: element ref's attribute
zachlankton opened this issue · comments
At the moment the best way to get a reference to an element is to assign an element to a variable like
let elmRef = <div></div>
elmRef.innerText = "Hello World"
return <>
<p>Other Elms</p>
{elmRef}
</>
But it would be nice to be able to do something roughly the equivalent of this:
let elmRef = ref();
const doSomethingLater = () => {
elmRef.current.innerText = "Hello World"
}
return <>
<p>Other Elms</p>
<div ref={elmRef}></div>
</>