phoenix_reactor v0.0.2 PhoenixReactor

Summary

Functions

react_container(name, props \\ %{}, html_attrs \\ [])

Specs

react_container(String.t | atom, map, Keyword.t) ::
  {:safe, list} |
  {:error, any}

Renders react component container.

Examples:

iex> PhoenixReactor.react_container("home")
{:safe, ["<div data-react-component=\"home\" data-react-props=\"{}\">", "", "</div>"]}

iex> PhoenixReactor.react_container("home", %{your_message: "Hello World"})
{:safe,
  ["<div data-react-component=\"home\" data-react-props=\"{&quot;yourMessage&quot;:&quot;Hello World&quot;}\">",
  "",
  "</div>"]}

iex> PhoenixReactor.react_container("home", %{your_message: "Hello World"}, class: "container", id: "home")
{:safe,
  ["<div class=\"container\" data-react-component=\"home\" data-react-props=\"{&quot;yourMessage&quot;:&quot;Hello World&quot;}\" id=\"home\">",
  "",
  "</div>"]}