Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Sep 8, 2017
1 parent 9791aa0 commit e290ab8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,34 @@
## Steps to a New App with rails/webpacker v3 plus React on Rails v9.beta:
First be sure to run `rails -v` and check that you are using Rails 5.1.3 or above. If you are using an older version of Rails, you'll need to install webpacker with React per the instructions [here](https://github.com/rails/webpacker).

### Basic installation

1. New Rails app: `rails new my-app --webpack=react`. `cd` into the directory.
2. Add beta gem version: `gem 'react_on_rails', '~> 9.0.0.beta.12'`
3. Run the generator: `rails generate react_on_rails:install`
4. Start the app: `foreman start -f Procfile.dev`
5. Visit http://localhost:3000/hello_world

Turn on HMR (Hot reloading)
### Turn on HMR (Hot reloading)

1. Edit `config/webpacker.yml` and set `hmr: true`
2. Start the app: `foreman start -f Procfile.dev-server`
3. Visit http://localhost:3000/hello_world
4. Edit `app/javascript/bundles/HelloWorld/components/HelloWorld.jsx`, hit save, and see the screen update.

### Turn on server rendering

*Does not work with hot reloading, yet, per [Webpacker issue #732](https://github.com/rails/webpacker/issues/732)*

1. Edit `app/views/hello_world/index.html.erb` and set `prerender` to `true`.
2. Refresh the page.

This is the line where you turn server rendering on by setting prerender to true:

```
<%%= react_component("<%= config[:component_name] %>", props: @hello_world_props, prerender: false) %>
```

---------------

## Thank you from Justin Gordon and [ShakaCode](http://www.shakacode.com)
Expand Down

0 comments on commit e290ab8

Please sign in to comment.