class ReactCell

Public Instance Methods

react_component(component_name, props = {}) click to toggle source

Props should be a Ruby hash

# File lib/react_rails_webpack/lib/react_cell.rb, line 8
def react_component(component_name, props = {})
  # Give second argument to content_tag some text
  # if you want to test to see if React is properly
  # replacing its content with a component
  content_tag(
    :div,
    javascript_tag('renderLastComponentDiv()'),
    class: 'react-component-target',
    data: {
      componentName: component_name,
      componentProps: props.to_json
    }
  )
end