mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 07:08:01 +00:00
Add Add React With Webpacker To A New Rails App as a rails til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||||
|
|
||||||
_648 TILs and counting..._
|
_649 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -403,6 +403,7 @@ _648 TILs and counting..._
|
|||||||
|
|
||||||
### Rails
|
### Rails
|
||||||
|
|
||||||
|
- [Add React With Webpacker To A New Rails App](rails/add-react-with-webpacker-to-a-new-rails-app.md)
|
||||||
- [Advance The Date](rails/advance-the-date.md)
|
- [Advance The Date](rails/advance-the-date.md)
|
||||||
- [All or Nothing Database Transactions](rails/all-or-nothing-database-transactions.md)
|
- [All or Nothing Database Transactions](rails/all-or-nothing-database-transactions.md)
|
||||||
- [Attach A File With Capybara](rails/attach-a-file-with-capybara.md)
|
- [Attach A File With Capybara](rails/attach-a-file-with-capybara.md)
|
||||||
|
|||||||
18
rails/add-react-with-webpacker-to-a-new-rails-app.md
Normal file
18
rails/add-react-with-webpacker-to-a-new-rails-app.md
Normal 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)
|
||||||
Reference in New Issue
Block a user