New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-rails-ujs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-rails-ujs

mounting components built with webpack (compatible with react-rails)

1.0.0-beta3
Source
npm
Version published
Weekly downloads
4.8K
4.89%
Maintainers
1
Weekly downloads
 
Created
Source

react-rails-ujs

npm version Downloads

This npm package is replacement for react-rails when assets pipeline is completely disabled and replaced with webpack bundles.

Install

npm i --save react-rails-ujs

Add react_component helper

module ApplicationHelper
  def react_component(name, props = {}, options = {}, &block)
    html_options = options.reverse_merge(data: {
      react_class: name,
      react_props: (props.is_a?(String) ? props : props.to_json)
    })
    content_tag(:div, '', html_options, &block)
  end
end

Usage

Render components into rails views

<%= react_component('Message', text: 'Hello react-rails-ujs') %>

Mount webpack bundled components

import { mountComponents } from './react-rails-ujs';

import { Message } from './components/Message';

mountComponents({
  Message,
});

Keywords

react-rails

FAQs

Package last updated on 05 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts