#is there any way to wrap a component in a click handler?

5 messages · Page 1 of 1 (latest)

halcyon cobalt
near widget
#

I don't think so, a click handler must be attached to a dom element, you cannot use a fragment to attach an event listener since this is just a workaround to the fact that JSX doesn't support having children as an array of elements. When the JSX is compiled to HTML, the fragment is removed and no DOM element is created.

If you want your component to be clickable, why not pass a click callback and in your component have a div or any other element that has a onClick?

#

unfortunately it doesn't seem to have an onClick 😦 It only. Looking at the signature of Refs it only has refs, added, removed and onChange

halcyon cobalt
#

this, but just in the ref callback