Hi!
I would like to access the assigns that may be passed to components when using it in a LiveView, in the module where I define the component but outside the component function. For example when I use this component in a Liveview passing:
<.Components.heading title="Hello!">
<.Components.greet name="John">
defmodule Components do
# In Phoenix apps, the line is typically: use MyAppWeb, :html
use Phoenix.Component
attr :title, :string, required: true
def heading(assigns) do
~H"""
<h1><%= @title %></h1>
"""
end
attr :name, :string, required: true
def greet(assigns) do
~H"""
<p>Hello <%= @name %></p>
"""
end
heading_assigns = *Function that access them;*
# %{title: "Hello!"}
greet_assigns = *Function that access them;*
# %{name: "John"}
end
Thank you.