ClickToComponent (Click To Component v0.2.0)

Documentation for ClickToComponent.

Summary

Functions

Returns the global on_mount/1 LiveView hook for handling events as quoted code.

Renders the ClickToComponent hook.

Functions

Returns the global on_mount/1 LiveView hook for handling events as quoted code.

Add to your lib/my_app_web.ex file as follows:

def live_view(opts \ []) do
  quote do
    use Phoenix.LiveView,
      layout: {MyAppWeb.Layouts, :app}

    unquote(ClickToComponent.hooks())

    # Rest of live_view quoted code...
  end
end
Link to this function

render(assigns)

Renders the ClickToComponent hook.

Add to your lib/my_app_web/layouts/root.html.heex file as follows:

<body>
  <!-- Rest of layout body markup... -->
  <ClickToComponent.render />
</body>