Handling a phx-hook event in a child LiveComponent

Hi!
I am able to send phx-click and phx-submit events to my child LiveComponent process by using phx_target: @myself on those elements, but I cannot get an infinite scroll hook to be received in my child component when setting phx-target to @myself on the html element.
Does anyone know if it is possible for hook events to be sent to and caught in a child component?
Thanks!
Dan

2 Likes

pushEventTo Is what you are looking for. It accepts a component DOM ID or the component id itself (@myself) which you can place as a dom attr. Search the docs for more info (I’m on mobile or I would link :))

5 Likes

Thank you for your quick answer! I’m in the middle of reading your book Metaprogramming Elixir and having a blast!

1 Like

docs! :
https://hexdocs.pm/phoenix_live_view/js-interop.html#client-hooks

1 Like