Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When render is called multiple times #342

Open
kethan opened this issue Apr 8, 2022 · 3 comments
Open

When render is called multiple times #342

kethan opened this issue Apr 8, 2022 · 3 comments

Comments

@kethan
Copy link

kethan commented Apr 8, 2022

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)
@yisar
Copy link
Collaborator

yisar commented Apr 8, 2022

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

@kethan
Copy link
Author

kethan commented Apr 8, 2022

Hi here is an example I am using https://codesandbox.io/s/fre-custom-element-dzg4p8?file=/index.js

@kethan
Copy link
Author

kethan commented May 17, 2022

Any update or solution i can implement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants