Sha256: 6dce9dcf32bccd2aff3ee3f432ec1e0ce1852246dac104767291179afb3b35c6

Contents?: true

Size: 853 Bytes

Versions: 21

Compression:

Stored size: 853 Bytes

Contents

module React
  module Rails
    module ViewHelper
      # This class will be used for inserting tags into HTML.
      # It should implement:
      #   - #setup(controller_instance)
      #   - #teardown(controller_instance)
      #   - #react_component(name, props, options &block)
      # The default is {React::Rails::ComponentMount}
      mattr_accessor :helper_implementation_class

      # 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.
      def react_component(*args, &block)
        helper_obj = @__react_component_helper ||= helper_implementation_class.new
        helper_obj.react_component(*args, &block)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
react-rails-stupid-1.5.6 lib/react/rails/view_helper.rb
react-rails-stupid-1.5.5 lib/react/rails/view_helper.rb
react-rails-stupid-1.5.4 lib/react/rails/view_helper.rb
react-rails-stupid-1.5.3 lib/react/rails/view_helper.rb
react-rails-stupid-1.5.2 lib/react/rails/view_helper.rb
react-rails-stupid-1.5.1 lib/react/rails/view_helper.rb
react-rails-1.9.0 lib/react/rails/view_helper.rb
react-rails-1.8.2 lib/react/rails/view_helper.rb
react-rails-1.8.1 lib/react/rails/view_helper.rb
react-rails-1.8.0 lib/react/rails/view_helper.rb
react-rails-1.7.2 lib/react/rails/view_helper.rb
react-rails-1.7.1 lib/react/rails/view_helper.rb
react-rails-1.7.0 lib/react/rails/view_helper.rb
react-rails-1.6.2 lib/react/rails/view_helper.rb
react-rails-1.6.1 lib/react/rails/view_helper.rb
react-rails-1.6.0 lib/react/rails/view_helper.rb
react-rails-1.5.0 lib/react/rails/view_helper.rb
react-rails-1.4.2 lib/react/rails/view_helper.rb
react-rails-1.4.1 lib/react/rails/view_helper.rb
react-rails-1.4.0 lib/react/rails/view_helper.rb