lib/ReactRenderAnywhere.rb in react-render-anywhere-helper-0.2.0 vs lib/ReactRenderAnywhere.rb in react-render-anywhere-helper-0.2.1

- old
+ new

@@ -1,18 +1,19 @@ require "ReactRenderAnywhere/version" -class ReactRenderAnywhere +module ReactRenderAnywhere attr_accessor :build_name - - def initialize(build_name) - self.build_name = build_name + + def self.new(build_name:) + @build_name = build_name + self end - def render_component(name, element, props:) + def self.render_component(name, element, props:) content_tag( :div, "<script> - #{self.build_name}.default.render({ + #{@build_name}.default.render({ component: '#{name}', props: #{props.to_json()}, element: document.getElementById('#{element}'), }) </script>".html_safe,