Sha256: c44f6deda4ffbd001614be7a8d1989e72f8b097e5d938d844a4e02b59d9b3ae7

Contents?: true

Size: 880 Bytes

Versions: 27

Compression:

Stored size: 880 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) { capture &block if block_given? }
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
react-rails-2.7.1 lib/react/rails/view_helper.rb
react-rails-2.7.0 lib/react/rails/view_helper.rb
react-rails-2.7.0.rc.2 lib/react/rails/view_helper.rb
react-rails-2.7.0.rc.1 lib/react/rails/view_helper.rb
react-rails-2.7.0.rc.0 lib/react/rails/view_helper.rb
react-rails-2.6.2 lib/react/rails/view_helper.rb
react-rails-2.6.1 lib/react/rails/view_helper.rb
react-rails-2.6.0 lib/react/rails/view_helper.rb
react-rails-2.5.0 lib/react/rails/view_helper.rb
react-rails-2.4.7 lib/react/rails/view_helper.rb
react-rails-2.4.6 lib/react/rails/view_helper.rb
react-rails-2.4.5 lib/react/rails/view_helper.rb
react-rails-2.4.4 lib/react/rails/view_helper.rb
react-rails-2.4.4.pre lib/react/rails/view_helper.rb
react-rails-2.4.3 lib/react/rails/view_helper.rb
react-rails-2.4.2 lib/react/rails/view_helper.rb
react-rails-2.4.1 lib/react/rails/view_helper.rb
react-rails-2.4.0 lib/react/rails/view_helper.rb
react-rails-2.3.1 lib/react/rails/view_helper.rb
react-rails-2.3.0 lib/react/rails/view_helper.rb