Module: React::Rails::ViewHelper

Included in:
ControllerRenderer
Defined in:
lib/react/rails/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#react_component(*args, &block) ⇒ Object

Render a React component into the view using the helper_implementation_class

If called during a Rails controller-managed request, use the instance created by the controller.

Otherwise, make a new instance.



19
20
21
22
# File 'lib/react/rails/view_helper.rb', line 19

def react_component(*args, &block)
  helper_obj = @__react_component_helper ||= helper_implementation_class.new
  helper_obj.react_component(*args) { capture &block if block_given? }
end