lib/ReactRenderAnywhere.rb in react-render-anywhere-helper-0.1.7 vs lib/ReactRenderAnywhere.rb in react-render-anywhere-helper-0.1.8

- old
+ new

@@ -1,10 +1,18 @@ require "ReactRenderAnywhere/version" module ReactRenderAnywhere def render_component(name, element, props:) - content_for(:javascripts) do - render partial: "common/render_components", locals: { name: name, element: element, props: props } - end - content_tag(:div, nil, :class=>"react-render-anywhere", :id=>element) + content_tag( + :div, + "<script> + reactComponents.default.render({ + component: '#{name}', + props: #{props.to_json()}, + element: document.getElementById('#{element}'), + }) + </script>", + :class=>"react-render-anywhere", + :id=>element + ) end end