#[Liveview] Add attributes from parent component caller to the live component

5 messages · Page 1 of 1 (latest)

little ivy
#

Is there any way to pass attributes from parent to a live component

like having a component button and i want to add phx-click etc ...
I dont want to add one by one like <nutton phx-click={assigns[:"phx-click"]} ...

+liveview +components

#

[Liveview] Add attributes from parent component caller to the live component

little ivy
#

Im wondering if it will be better to have helper functions instead of live components 🤔

sour galleon
#

They run inside the LiveView process but have their own state and life-cycle. For this reason, they are also often called "stateful components". This is a contrast to Phoenix.Component, also known as "function components", which are stateless.

#

not sure if I understand your question correctly but you might be looking for functional components then