lib/ReactRenderAnywhere.rb in react-render-anywhere-helper-0.1.9 vs lib/ReactRenderAnywhere.rb in react-render-anywhere-helper-0.2.0
- old
+ new
@@ -1,12 +1,18 @@
require "ReactRenderAnywhere/version"
-module ReactRenderAnywhere
+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>
- reactComponents.default.render({
+ #{self.build_name}.default.render({
component: '#{name}',
props: #{props.to_json()},
element: document.getElementById('#{element}'),
})
</script>".html_safe,