Method: React.render

Defined in:
lib/react/top_level.rb,
lib/react/top_level_render.rb

.render(element, container) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/react/top_level.rb', line 57

def self.render(element, container)
  %x{
      console.error(
        "Warning: Using deprecated behavior of `React.render`,",
        "require \"react/top_level_render\" to get the correct behavior."
      );
  }
  container = `container.$$class ? container[0] : container`
  if !(`typeof ReactDOM === 'undefined'`)
    component = Native(`ReactDOM.render(#{element.to_n}, container, function(){#{yield if block_given?}})`) # v0.15+
  else
    raise "render is not defined.  In React >= v15 you must import it with ReactDOM"
  end

  component.class.include(React::Component::API)
  component
end