PhxComponentHelpers.forward_assigns
You're seeing just the function
forward_assigns
, go back to PhxComponentHelpers module for more information.
Forward and filter assigns to sub components.
Parameters
assigns
- your component assigns
Options
prefix
- will only forward assigns prefixed by the given prefix. Forwarded assign key will no longer have the prefixtake
- is a list of key (without prefix) that will be picked from assigns to be forwarded
If both options are given at the same time, the resulting assigns will be the union of the two.
Example
Following will forward an assign map containing %{button_id: 42, button_label: "label", phx_click: "save"}
as %{id: 42, label: "label", phx_click: "save"}
forward_assigns(assigns, prefix: :button, take: [:phx_click])