module ReactOnRails::Helper

def react_component_hash(component_name, options = {})


<%= react_helmet_app["componentHtml"] %>
<% end %>
<%= react_helmet_app['title'] %>
<% content_for :title do %>
id: "react-helmet-0", trace: true) %>
props: { helloWorldData: { name: "Mr. Server Side Rendering"}},
<% react_helmet_app = react_component_hash("ReactHelmetApp", prerender: true,
Here is an example of the view code:

3. Your view code must expect an object and not a string.
2. Your JavaScript Render-Function for server rendering must return an Object rather than a React component.
rendering.
1. prerender: true is automatically added, as this method doesn't make sense for client only
It is exactly like react_component except for the following:
adding meta-tags to a page.
react_component_hash is used to return multiple HTML strings for server rendering, such as for
def react_component_hash(component_name, options = {})
  options[:prerender] = true
  internal_result = internal_react_component(component_name, options)
  server_rendered_html = internal_result[:result]["html"]
  console_script = internal_result[:result]["consoleReplayScript"]
  render_options = internal_result[:render_options]
  if server_rendered_html.is_a?(String) && internal_result[:result]["hasErrors"]
    server_rendered_html = { COMPONENT_HTML_KEY => internal_result[:result]["html"] }
  end
  if server_rendered_html.is_a?(Hash)
    build_react_component_result_for_server_rendered_hash(
      server_rendered_html: server_rendered_html,
      component_specification_tag: internal_result[:tag],
      console_script: console_script,
      render_options: render_options
    )
  else
    msg = <<~MSG
      Render-Function used by react_component_hash for #{component_name} is expected to return
      an Object. See https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/client/app/startup/ReactHelmetServerApp.jsx
      for an example of the JavaScript code.
      Note, your Render-Function must either take 2 params or have the property
      `.renderFunction = true` added to it to distinguish it from a React Function Component.
    MSG
    raise ReactOnRails::Error, msg
  end
end