1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-05 08:08:02 +00:00

Add Add React With Webpacker To A New Rails App as a rails til

This commit is contained in:
jbranchaud
2018-03-24 11:55:28 -05:00
parent 54f8593ff7
commit 1d60000ae1
2 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
# Add React With Webpacker To A New Rails App
[Webpacker](https://github.com/rails/webpacker) makes it easy to manage
app-like JavaScript in the context of a Rails app. React is a great
candidate for this kind of webpack-powered JavaScript processing pipeline.
To set up a new Rails project with Webpack and React wired up, add the
`--webpack=react` flag:
```bash
$ rails new rails-react-app --webpack=react
```
As part of the generated app, you will get a `app/javascript/packs`
directory with a `hello_react.jsx` file that has a really basic React
component.
[source](https://github.com/rails/webpacker#react)