Class: RailsReactStdio::React

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_react_stdio/react.rb

Class Method Summary collapse

Class Method Details

.render(component_path, props) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/rails_react_stdio/react.rb', line 6

def render(component_path, props)
  react_stdio_hash = { component: component_path, props: props }
  react_stdio_json = react_stdio_hash.to_json
  results = open_stdio(react_stdio_json)
  results_hash = JSON.parse(results)
  parse_stdout(results_hash)
end