QwikDev / qwik

Instant-loading web apps, without effort
https://qwik.dev
MIT License
20.9k stars 1.31k forks source link

[✨] A way to clone elements #4317

Open Dindaleon opened 1 year ago

Dindaleon commented 1 year ago

Is your feature request related to a problem?

I am making a drag and drop interface for my clients and would like to have a way to clone elements and keep their reactivity.

Describe the solution you'd like

I would like to have something like React with React.cloneElement()

Describe alternatives you've considered

At the moment i am using the default element.cloneNode(true) but its reactivity is being lost.

Additional context

No response

gioboa commented 1 year ago

How did you solve this specific task?

PatrickJS commented 11 months ago

By reactivity you're talking about signals.

So you can clone the html and any QRL should work but when you run into signals then them embedded data becomes an issue. You can also use context and if you have an issue with keys you can use uuids. If you have examples of what you're doing then it would make it easier to understand.

wmertens commented 10 months ago

@Dindaleon can't you solve this using components? You know what you are dragging, so you can render it twice?

gioboa commented 1 month ago

is it still a valid issue?