When render is called multiple times
kethan opened this issue · comments
Kethan commented
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)
伊撒尔 commented
Fre can't reuse DOM yet, but I don't know what scenario you use custom element in?
Kethan commented
Hi here is an example I am using https://codesandbox.io/s/fre-custom-element-dzg4p8?file=/index.js
Kethan commented
Any update or solution i can implement?