Sha256: 5f23c6161e9692f31bccd6bd03ce870368f28f6c2f8574aed4070894fa780133

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

require "ReactRenderAnywhere/version"

class ReactRenderAnywhere
  attr_accessor :build_name
 
  def initialize(build_name)
    self.build_name = build_name
  end

  def render_component(name, element, props:)
    content_tag(
      :div,
      "<script>
        #{self.build_name}.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.2.0 lib/ReactRenderAnywhere.rb