Sha256: 9fe04dffae9795d7c4249676925fea229b37c856a64c82cebcf1cd41607a5a8d

Contents?: true

Size: 432 Bytes

Versions: 1

Compression:

Stored size: 432 Bytes

Contents

require "ReactRenderAnywhere/version"

module ReactRenderAnywhere
  def render_component(name, element, props:)
    content_tag(
      :div,
      "<script>
        reactComponents.default.render({
          component: '#{name}',
          props: #{props.to_json()},
          element: document.getElementById('#{element}'),
        })
      </script>".html_safe,
      :class=>"react-render-anywhere", :id=>element
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
react-render-anywhere-helper-0.1.2 lib/ReactRenderAnywhere.rb