Rezact / Rezact

A JavaScript Framework/Library (call it what you want) that blends the best of svelte, solid, react, and many others.

Home Page:https://rezact.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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>
</>