frejs / fre

:ghost: Tiny Concurrent UI library with Fiber.

Home Page:https://fre.deno.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When render is called multiple times

kethan opened this issue · comments

Hi, when I call render multiple times the component is attached in the dom multiple times. I have a requirement to re-render multiple times for creating custom elements.

import { render, useState } from "fre"

function App() {
  const [count, setCount] = useState(0)
  return (
    <>
      <h1>{count}</h1>
      <button onClick={() => setCount(count + 1)}>+</button>
    </>
  )
}

render(<App />, document.body)
render(<App />, document.body)
render(<App />, document.body)

Fre can't reuse DOM yet, but I don't know what scenario you use custom element in?

Any update or solution i can implement?