LiveView Hooks. What am I doing wrong?

Following along with this example from the docs:
https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html#module-js-interop-and-client-controlled-dom

I’ve added this little test hook.
https://github.com/MorphicPro/morphic.pro/blob/liveview/assets/js/app.js#L34-L48

I’ve added the dom element
https://github.com/MorphicPro/morphic.pro/blob/liveview/lib/morphic_pro_web/live/post_live/edit.html.leex

But I get nothing yet I can see the Hook in the LiveSocket and even call it directly.

What am I missing here?

1 Like

Looks like a typo
“mount” > “mounted”

Thanks to @ Elijah Kim for pointing this out.

4 Likes

Yes, the correct way to call is “mounted( )” :blush: