Class: ReactCell
- Inherits:
-
Cell::Concept
- Object
- Cell::Concept
- ReactCell
- Includes:
- ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::TagHelper
- Defined in:
- lib/react_rails_webpack/lib/react_cell.rb
Instance Method Summary collapse
-
#react_component(component_name, props = {}) ⇒ Object
Props should be a Ruby hash.
Instance Method Details
#react_component(component_name, props = {}) ⇒ Object
Props should be a Ruby hash
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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 |