#Does using props in onclick events always require clones?

1 messages · Page 1 of 1 (latest)

tough jetty
#

I'd like to use the component props in multiple onclick events. But I can only do that if I create a clone for each onclick (classic borrow checker things). That makes sense, but is there a smarter way of doing that, other than cloning a bunch of stuff up front before creating the UI with rsx! and using the one clone per callback?

onyx bloom
#

You can make your props fields copy by wrapping them in ReadOnlySignal

#

It will automatically be converted from T to ReadOnlySignal<T>