Liveview Handling multiple phx-hook on same DOM node

I sometimes need to attach multiple phx-hook on same DOM node when using liveview. I don’t think this is currently supported.
What would be the best way to handle this ?

1 Like

I usually add the phx-hook on an inner/outer node (might need to create one if none are available).

this is not supported today, but you you can delegate from a single hook out to your others

That is an interesting idea. How would you do that?

I recently wrote a helper for that:

My motivation was that I wanted to handle custom events from my web components and also play with the idea of lazy loading hooks to reduce the main bundle size(this last part isnt in the gist)

1 Like