Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
react-webpack-rails
Advanced tools
Readme
This gem provides easy and convenient way to build modern JavaScript stack on top of Rails applications using Webpack and React.
Add this line to your application's Gemfile:
gem 'react_webpack_rails'
Execute:
$ bundle
Then run installation:
$ rails g react_webpack_rails:install
read more about install generator
By default, react-webpack-rails
uses Babel Stage 1 - Proposal. If you want to change the stage, you can do so in the .babelrc
file. It is however not recommended to use Stage 0 in a production app, because the features present there can be dropped, which would break your application.
<body>
:(it's not needed when you want to use just webpack in watch mode without hot-reloading)
<%= render 'layouts/react_hot_assets' %>
import Component from './components/some-component';
RWR.registerComponent('customComponentName', Component);
<%= react_component('customComponentName', { user: User.last }) %>
const element = $('#my-element');
RWR.renderComponent('customComponentName', {user_id: 1}, element);
def action_name
render react_component: 'customComponentName', props: { user_id: 1 }
end
Run webpack in watch mode using script:
$ npm start
Run webpack in hot-auto-reloading mode using script (to use it you have to add react_hot_assets
partial as mentioned before):
$ npm run start-hot-dev
If you are using server side render in components (it's enabled by default in generated example), run node server:
$ npm run rwr-node-dev-server
Run webpack in production mode before compiling assets using script:
$ npm run build
If you are using server side render (it's enabled by default in generated example), run node server:
$ npm run rwr-node-server
Check docs/deployment.md
See the contribution guide.
The gem is available as open source under the terms of the MIT License.
FAQs
Js part of react_webpack_rails - webpack based React & Rails integration.
The npm package react-webpack-rails receives a total of 623 weekly downloads. As such, react-webpack-rails popularity was classified as not popular.
We found that react-webpack-rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.