react_on_rails 12.0.0 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +12 -2
- data/.eslintrc +2 -1
- data/.github/workflows/lint-js-and-ruby.yml +53 -0
- data/.github/workflows/main.yml +178 -0
- data/.github/workflows/package-js-tests.yml +35 -0
- data/.github/workflows/rspec-package-specs.yml +45 -0
- data/.prettierrc +0 -3
- data/.rubocop.yml +47 -38
- data/.travis.yml +8 -4
- data/CHANGELOG.md +58 -28
- data/CONTRIBUTING.md +4 -3
- data/Gemfile +1 -33
- data/Gemfile.development_dependencies +51 -0
- data/NEWS.md +5 -0
- data/README.md +116 -105
- data/SUMMARY.md +1 -1
- data/docs/{basics → additional-details}/generator-details.md +1 -6
- data/docs/{outdated → additional-details}/manual-installation-overview.md +6 -6
- data/docs/additional-details/recommended-project-structure.md +69 -0
- data/docs/additional-details/upgrade-webpacker-v3-to-v4.md +10 -0
- data/docs/api/javascript-api.md +5 -5
- data/docs/api/redux-store-api.md +5 -5
- data/docs/api/view-helpers-api.md +11 -12
- data/docs/basics/client-vs-server-rendering.md +4 -2
- data/docs/basics/configuration.md +43 -26
- data/docs/basics/deployment.md +2 -2
- data/docs/basics/hmr-and-hot-reloading-with-the-webpack-dev-server.md +64 -9
- data/docs/{outdated → basics}/how-react-on-rails-works.md +8 -9
- data/docs/basics/installation-into-an-existing-rails-app.md +13 -6
- data/docs/basics/react-server-rendering.md +8 -5
- data/docs/basics/render-functions-and-railscontext.md +1 -1
- data/docs/basics/rspec-configuration.md +10 -10
- data/docs/{tutorial.md → basics/tutorial.md} +28 -30
- data/docs/basics/upgrading-react-on-rails.md +52 -15
- data/docs/basics/webpack-configuration.md +14 -22
- data/docs/contributor-info/linters.md +5 -6
- data/docs/contributor-info/pull-requests.md +2 -4
- data/docs/contributor-info/releasing.md +1 -1
- data/docs/home.md +382 -0
- data/docs/{outdated → javascript}/code-splitting.md +8 -8
- data/docs/javascript/converting-from-custom-webpack-config-to-rails-webpacker-config.md +10 -0
- data/docs/{additional-reading → javascript}/images.md +5 -6
- data/docs/{additional-reading → javascript}/react-router.md +1 -1
- data/docs/{additional-reading → javascript}/server-rendering-tips.md +4 -1
- data/docs/{articles.md → misc/articles.md} +1 -1
- data/docs/misc/doctrine.md +5 -6
- data/docs/outdated/deferred-rendering.md +39 -0
- data/docs/outdated/rails-assets-relative-paths.md +3 -3
- data/docs/outdated/rails-assets.md +8 -8
- data/docs/outdated/rails3.md +2 -2
- data/docs/{additional-reading → rails}/convert-rails-5-api-only-app.md +1 -1
- data/docs/rails-webpacker-react-integration-options.md +182 -0
- data/docs/testimonials/testimonials.md +6 -6
- data/lib/generators/react_on_rails/base_generator.rb +8 -1
- data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -1
- data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +8 -2
- data/lib/generators/react_on_rails/templates/dev_tests/spec/simplecov_helper.rb +1 -1
- data/lib/generators/react_on_rails/templates/dev_tests/spec/{features → system}/hello_world_spec.rb +2 -2
- data/lib/react_on_rails/configuration.rb +2 -0
- data/lib/react_on_rails/git_utils.rb +3 -3
- data/lib/react_on_rails/helper.rb +23 -17
- data/lib/react_on_rails/locales/base.rb +3 -3
- data/lib/react_on_rails/locales/to_js.rb +0 -4
- data/lib/react_on_rails/locales/to_json.rb +0 -4
- data/lib/react_on_rails/prerender_error.rb +1 -1
- data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +6 -6
- data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +1 -1
- data/lib/react_on_rails/test_helper.rb +2 -0
- data/lib/react_on_rails/utils.rb +24 -4
- data/lib/react_on_rails/version.rb +1 -1
- data/lib/react_on_rails/webpacker_utils.rb +9 -5
- data/lib/tasks/assets.rake +35 -14
- data/package.json +24 -29
- data/rakelib/docker.rake +0 -5
- data/rakelib/examples.rake +1 -1
- data/rakelib/lint.rake +4 -10
- data/rakelib/release.rake +28 -16
- data/rakelib/run_rspec.rake +10 -11
- data/rakelib/task_helpers.rb +16 -4
- data/react_on_rails.gemspec +3 -17
- data/yarn.lock +2272 -4960
- metadata +50 -224
- data/docs/additional-reading/upgrade-webpacker-v3-to-v4.md +0 -10
- data/docs/additional-reading/webpack-dev-server.md +0 -15
- data/docs/basics/recommended-project-structure.md +0 -77
- data/ruby-lint.yml +0 -25
- /data/docs/{basics → additional-details}/migrating-from-react-rails.md +0 -0
- /data/docs/{additional-reading → additional-details}/updating-dependencies.md +0 -0
- /data/docs/{additional-reading → deployment}/elastic-beanstalk.md +0 -0
- /data/docs/{basics → deployment}/heroku-deployment.md +0 -0
- /data/docs/{additional-reading → javascript}/angular-js-integration-migration.md +0 -0
- /data/docs/{additional-reading → javascript}/asset-pipeline.md +0 -0
- /data/docs/{additional-reading → javascript}/capistrano-deployment.md +0 -0
- /data/docs/{additional-reading → javascript}/credits.md +0 -0
- /data/docs/{additional-reading → javascript}/foreman-issues.md +0 -0
- /data/docs/{additional-reading → javascript}/node-dependencies-and-npm.md +0 -0
- /data/docs/{additional-reading → javascript}/react-and-redux.md +0 -0
- /data/docs/{additional-reading → javascript}/react-helmet.md +0 -0
- /data/docs/{additional-reading → javascript}/troubleshooting-when-using-webpacker.md +0 -0
- /data/docs/{additional-reading → javascript}/webpack-v1-notes.md +0 -0
- /data/docs/{additional-reading → javascript}/webpack.md +0 -0
- /data/docs/{coding-style → misc}/style.md +0 -0
- /data/docs/{additional-reading → misc}/tips.md +0 -0
- /data/docs/{additional-reading → rails}/rails-engine-integration.md +0 -0
- /data/docs/{additional-reading → rails}/rails_view_rendering_from_inline_javascript.md +0 -0
- /data/docs/{additional-reading → rails}/turbolinks.md +0 -0
data/CONTRIBUTING.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* See other docs in [docs/contributor-info](./docs/contributor-info)
|
|
6
6
|
|
|
7
7
|
## To run tests:
|
|
8
|
+
* [Yalc](https://github.com/whitecolor/yalc) must be installed globally for most local development.
|
|
8
9
|
* After updating code via git, to prepare all examples and run all tests:
|
|
9
10
|
|
|
10
11
|
```sh
|
|
@@ -62,9 +63,9 @@ cd react_on_rails/
|
|
|
62
63
|
yarn
|
|
63
64
|
|
|
64
65
|
# Update the lib directory with babel compiled files
|
|
65
|
-
yarn run build
|
|
66
|
+
yarn run build-watch
|
|
66
67
|
```
|
|
67
|
-
|
|
68
|
+
|
|
68
69
|
You need to do this once:
|
|
69
70
|
|
|
70
71
|
```
|
|
@@ -192,7 +193,7 @@ Then run `bundle`.
|
|
|
192
193
|
|
|
193
194
|
The main installer can be run with ```rails generate react_on_rails:install```
|
|
194
195
|
|
|
195
|
-
Then use yalc to add the npm module.
|
|
196
|
+
Then use yalc to add the npm module.
|
|
196
197
|
|
|
197
198
|
Be sure that your ran this first at the top level of React on Rails
|
|
198
199
|
|
data/Gemfile
CHANGED
|
@@ -5,36 +5,4 @@ source "https://rubygems.org"
|
|
|
5
5
|
# Specify your gem"s dependencies in react_on_rails.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
# They must be defined here because of the way Travis CI works, in that it will only
|
|
10
|
-
# bundle install from a single Gemfile. Therefore, all gems that we will need for any dummy/example
|
|
11
|
-
# app have to be manually added to this file.
|
|
12
|
-
gem "bootsnap", ">= 1.1.0", require: false
|
|
13
|
-
gem "bootstrap-sass"
|
|
14
|
-
gem "jbuilder"
|
|
15
|
-
gem "jquery-rails"
|
|
16
|
-
gem "mini_racer"
|
|
17
|
-
gem "puma"
|
|
18
|
-
gem "rails_12factor"
|
|
19
|
-
gem "ruby-lint", require: false
|
|
20
|
-
gem "sass-rails"
|
|
21
|
-
gem "scss_lint", require: false
|
|
22
|
-
gem "sdoc", group: :doc
|
|
23
|
-
gem "spring"
|
|
24
|
-
gem "sprockets", "~>3.0"
|
|
25
|
-
gem "sqlite3", "~> 1.3.6"
|
|
26
|
-
gem "turbolinks"
|
|
27
|
-
gem "uglifier"
|
|
28
|
-
gem "web-console", group: :development
|
|
29
|
-
|
|
30
|
-
# below are copied from spec/dummy/Gemfile
|
|
31
|
-
gem "capybara"
|
|
32
|
-
gem "capybara-screenshot"
|
|
33
|
-
gem "launchy"
|
|
34
|
-
gem "rspec-rails"
|
|
35
|
-
gem "rspec-retry"
|
|
36
|
-
gem "selenium-webdriver"
|
|
37
|
-
gem "webpacker", ">= 4.0.0"
|
|
38
|
-
|
|
39
|
-
gem "equivalent-xml", github: "mbklein/equivalent-xml"
|
|
40
|
-
gem "rainbow"
|
|
8
|
+
eval_gemfile File.expand_path("./Gemfile.development_dependencies", __dir__)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
gem "webpacker"
|
|
4
|
+
gem "bootsnap", require: false
|
|
5
|
+
gem "rails"
|
|
6
|
+
gem "sqlite3"
|
|
7
|
+
gem "sass-rails"
|
|
8
|
+
gem "uglifier"
|
|
9
|
+
gem "jquery-rails"
|
|
10
|
+
gem "puma"
|
|
11
|
+
|
|
12
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
|
13
|
+
gem "turbolinks" if ENV["DISABLE_TURBOLINKS"].nil? || ENV["DISABLE_TURBOLINKS"].strip.empty?
|
|
14
|
+
|
|
15
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
|
16
|
+
gem "jbuilder"
|
|
17
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
|
18
|
+
gem "sdoc", group: :doc
|
|
19
|
+
|
|
20
|
+
gem "sprockets"
|
|
21
|
+
|
|
22
|
+
gem "amazing_print"
|
|
23
|
+
gem "mini_racer"
|
|
24
|
+
|
|
25
|
+
group :development, :test do
|
|
26
|
+
gem "listen"
|
|
27
|
+
gem "pry"
|
|
28
|
+
gem "pry-byebug"
|
|
29
|
+
gem "pry-doc"
|
|
30
|
+
gem "pry-rails"
|
|
31
|
+
gem "pry-rescue"
|
|
32
|
+
gem "rubocop", require: false
|
|
33
|
+
gem "rubocop-performance", require: false
|
|
34
|
+
gem "rubocop-rspec", require: false
|
|
35
|
+
gem "scss_lint", require: false
|
|
36
|
+
gem "spring"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
group :test do
|
|
40
|
+
gem "capybara"
|
|
41
|
+
gem "capybara-screenshot"
|
|
42
|
+
gem "coveralls", require: false
|
|
43
|
+
gem "equivalent-xml"
|
|
44
|
+
gem "generator_spec"
|
|
45
|
+
gem "launchy"
|
|
46
|
+
gem "rspec_junit_formatter"
|
|
47
|
+
gem "rspec-rails"
|
|
48
|
+
gem "rspec-retry"
|
|
49
|
+
gem "selenium-webdriver"
|
|
50
|
+
gem "webdrivers", "3.9.4"
|
|
51
|
+
end
|
data/NEWS.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
*We'll keep a history of the news. A few bullets at the top will also show on the [README.md](./README.md).*
|
|
4
4
|
|
|
5
|
+
* July 8, 2020: Release **v12**.
|
|
6
|
+
1. **React Hooks Support** for top level components
|
|
7
|
+
2. **Typescript bindings**
|
|
8
|
+
3. **rails/webpacker** "just works" with React on Rails by default.
|
|
9
|
+
4. i18n support for generating a JSON file rather than a JS file.
|
|
5
10
|
* 2018-02-27: **Version 10.1.2** Supports the React API for ReactDOM.hydrate.
|
|
6
11
|
* 2017-09-06: **VERSION 9.0.0 shipped!** This version depends on Webpacker directly. See [Upgrading React on Rails](./docs/basics/upgrading-react-on-rails.md) for more concise instructions on upgrading.
|
|
7
12
|
* Always see the [CHANGELOG.md](./CHANGELOG.md) for the latest project changes.
|
data/README.md
CHANGED
|
@@ -3,43 +3,51 @@
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<a href="https://shakacode.com/"><img src="https://user-images.githubusercontent.com/10421828/79436256-517d0500-7fd9-11ea-9300-dfbc7c293f26.png"></a>
|
|
5
5
|
<a href="https://forum.shakacode.com/"><img src="https://user-images.githubusercontent.com/10421828/79436266-53df5f00-7fd9-11ea-94b3-b985e1b05bdc.png"></a>
|
|
6
|
-
<a href="https://
|
|
6
|
+
<a href="https://www.shakacode.com/react-on-rails-pro"><img src="https://user-images.githubusercontent.com/10421828/79436265-53df5f00-7fd9-11ea-8220-fc474f6a856c.png"></a>
|
|
7
7
|
<a href="https://github.com/sponsors/shakacode"><img src="https://user-images.githubusercontent.com/10421828/79466109-cdd90d80-8004-11ea-88e5-25f9a9ddcf44.png"></a>
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
[](
|
|
12
|
+
[](LICENSE.md) [](https://travis-ci.org/shakacode/react_on_rails) [](https://badge.fury.io/rb/react_on_rails) [](https://badge.fury.io/js/react-on-rails) [](https://codeclimate.com/github/shakacode/react_on_rails) [](https://coveralls.io/github/shakacode/react_on_rails?branch=master) [](https://rubygems.org/gems/react_on_rails)
|
|
13
13
|
|
|
14
|
-
*These are the docs for React on Rails 12
|
|
14
|
+
*These are the docs for React on Rails 12. To see the version 11 docs, [click here](https://github.com/shakacode/react_on_rails/tree/11.3.0).*
|
|
15
15
|
|
|
16
16
|
#### News
|
|
17
|
-
**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[docs/basics/upgrading-react-on-rails](./docs/basics/upgrading-react-on-rails.md#upgrading-to-v12).
|
|
27
|
-
|
|
28
|
-
2. See Justin's RailsConf talk: [Webpacker, It-Just-Works, But How?](http://railsconf.com/2020/video/justin-gordon-webpacker-it-just-works-but-how).
|
|
29
|
-
|
|
30
|
-
**April 2, 2020**:
|
|
31
|
-
* Are you interested in support for React on Rails? If so check out [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro).
|
|
32
|
-
* HMR is working with [Loadable Components](https://loadable-components.com) for a both amazing hot-reloading developer experience and great runtime performance. Please [email me](mailto:justin@shakacode.com) if you'd like to use [Loadable Components Code Splitting](https://loadable-components.com/docs/code-splitting/) to speed up your app by reducing your bundle sizes and lazily loading the code that's needed.
|
|
33
|
-
* `react_on_rails` fully supports `rails/webpacker`. The example test app in `spec/dummy` was recently converted over to use rails/webpacker v4. It's a good example of how to leverage rails/webpacker's webpack configuration.
|
|
17
|
+
**October 14, 2020**: [RUBY ROGUES
|
|
18
|
+
RR 474: React on Rails V12 – Don’t Shave That Yak! with Justin Gordon](https://devchat.tv/ruby-rogues/rr-474-react-on-rails-v12-dont-shave-that-yak-with-justin-gordon/).
|
|
19
|
+
|
|
20
|
+
**October 1, 2020**: See the [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy) example repo for a simple configuration of webpack via the rails/webpacker gem
|
|
21
|
+
that supports SSR.
|
|
22
|
+
|
|
23
|
+
**August 2, 2020**: See the example repo of [React on Rails Tutorial With SSR, HMR fast refresh, and TypeScript](https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh) for a new way to setup the creation of your SSR bundle with `rails/webpacker`.
|
|
24
|
+
|
|
25
|
+
**July 8, 2020**: Release v12 of React on Rails.
|
|
34
26
|
|
|
27
|
+
**Major Improvements**
|
|
28
|
+
|
|
29
|
+
1. **React Hooks Support** for top level components
|
|
30
|
+
2. **Typescript bindings**
|
|
31
|
+
3. **rails/webpacker** "just works" with React on Rails by default.
|
|
32
|
+
4. i18n support for generating a JSON file rather than a JS file.
|
|
33
|
+
|
|
34
|
+
Be sure to see the [CHANGELOG.md](https://github.com/shakacode/react_on_rails/tree/master/CHANGELOG.md) and read the upgrade instructions:
|
|
35
|
+
[docs/basics/upgrading-react-on-rails](https://www.shakacode.com/react-on-rails/docs/basics/upgrading-react-on-rails#upgrading-to-v12).
|
|
36
|
+
|
|
37
|
+
* See Justin's RailsConf talk: [Webpacker, It-Just-Works, But How?](http://railsconf.com/2020/video/justin-gordon-webpacker-it-just-works-but-how).
|
|
38
|
+
* Are you interested in support for React on Rails? Do you want to use Node.js to do your server-side rendering so libraries like Emotion and Loadable Components just work, as compared to rendering via Ruby embedded JS? If so check out [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro).
|
|
39
|
+
* HMR is working with [Loadable Components](https://loadable-components.com) for a both amazing hot-reloading developer experience and great runtime performance. Please [email me](mailto:justin@shakacode.com) if you'd like to use [Loadable Components Code Splitting](https://loadable-components.com/docs/code-splitting/) to speed up your app by reducing your bundle sizes and lazily loading the code that's needed.
|
|
35
40
|
---
|
|
36
41
|
|
|
37
42
|
#### About
|
|
38
43
|
React on Rails integrates Rails with (server rendering of) Facebook's [React](https://github.com/facebook/react) front-end framework.
|
|
39
44
|
|
|
40
|
-
This project is
|
|
45
|
+
This project is maintained by the software consulting firm [ShakaCode](https://www.shakacode.com). We focus on Ruby on Rails applications with React front-ends, often using TypeScript or ReasonML. We also build Gatsby sites. See [our recent work](https://www.shakacode.com/recent-work) for examples of what we do.
|
|
41
46
|
|
|
42
|
-
Interested in optimizing your webpack setup for React on Rails including code
|
|
47
|
+
Interested in optimizing your webpack setup for React on Rails including code
|
|
48
|
+
splitting with [react-router](https://github.com/ReactTraining/react-router#readme),
|
|
49
|
+
and [loadable-components](https://loadable-components.com/) with server-side rendering?
|
|
50
|
+
We just did this for Popmenu, [lowering Heroku costs 20-25% while getting a 73% decrease in average response times](https://www.shakacode.com/recent-work/popmenu/).
|
|
43
51
|
|
|
44
52
|
Feel free to contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com), maintainer of React on Rails, for more information.
|
|
45
53
|
|
|
@@ -49,32 +57,35 @@ Feel free to contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakaco
|
|
|
49
57
|
|
|
50
58
|
## Project Objective
|
|
51
59
|
|
|
52
|
-
To provide a high performance framework for integrating Ruby on Rails with React via the [**Webpacker**](https://github.com/rails/webpacker) gem especially in regards to React Server Rendering.
|
|
60
|
+
To provide a high performance framework for integrating Ruby on Rails with React via the [**Webpacker**](https://github.com/rails/webpacker) gem especially in regards to React Server-Side Rendering for better SEO and improved performance.
|
|
53
61
|
|
|
54
62
|
## Features and Why React on Rails?
|
|
55
63
|
|
|
56
|
-
Given that rails/webpacker gem already provides basic React integration, why would you use "React on Rails"?
|
|
64
|
+
Given that `rails/webpacker` gem already provides basic React integration, why would you use "React on Rails"?
|
|
57
65
|
|
|
58
|
-
1.
|
|
66
|
+
1. Easy passing of props directly from your Rails view to your React components rather than having your Rails view load and then make a separate request to your API.
|
|
59
67
|
1. Tight integration with [rails/webpacker](https://github.com/rails/webpacker).
|
|
60
|
-
1. Server
|
|
61
|
-
1. [Redux](https://github.com/reactjs/redux) and [React Router](https://github.com/
|
|
62
|
-
1. [Internationalization (I18n) and (localization)](https://
|
|
63
|
-
1. A supportive community. This [web search shows how live public sites are using React on Rails](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com/).
|
|
68
|
+
1. Server-Side Rendering (SSR), often used for SEO crawler indexing and UX performance, is not offered by `rails/webpacker`.
|
|
69
|
+
1. [Redux](https://github.com/reactjs/redux) and [React Router](https://github.com/ReactTraining/react-router#readme) integration with server-side-rendering.
|
|
70
|
+
1. [Internationalization (I18n) and (localization)](https://www.shakacode.com/react-on-rails/docs/basics/i18n)
|
|
71
|
+
1. A supportive community. This [web search shows how live public sites are using React on Rails](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com+depth%3Aall/).
|
|
64
72
|
1. [Reason ML Support](https://github.com/shakacode/reason-react-on-rails-example).
|
|
65
73
|
|
|
74
|
+
See [Rails/Webpacker React Integration Options](./docs/rails-webpacker-react-integration-options.md) for comparisons to other gems.
|
|
75
|
+
|
|
66
76
|
See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
|
|
67
77
|
|
|
68
78
|
## ShakaCode Forum Premium Content
|
|
69
79
|
_Requires creating a free account._
|
|
70
|
-
|
|
80
|
+
|
|
71
81
|
* [How to use different versions of a file for client and server rendering](https://forum.shakacode.com/t/how-to-use-different-versions-of-a-file-for-client-and-server-rendering/1352)
|
|
82
|
+
* [How to conditionally render server side based on the device type](https://forum.shakacode.com/t/how-to-conditionally-render-server-side-based-on-the-device-type/1473)
|
|
72
83
|
|
|
73
84
|
----
|
|
74
85
|
|
|
75
86
|
# Docs
|
|
76
87
|
|
|
77
|
-
**Consider browsing this on our [
|
|
88
|
+
**Consider browsing this on our [website](https://www.shakacode.com/react-on-rails/docs/).**
|
|
78
89
|
|
|
79
90
|
## Prerequisites
|
|
80
91
|
|
|
@@ -82,16 +93,16 @@ Ruby on Rails >=5 and rails/webpacker 4.2+.
|
|
|
82
93
|
|
|
83
94
|
## Getting Started
|
|
84
95
|
|
|
85
|
-
Note, the best way to understand how to use ReactOnRails is to study a few simple examples. You can do a quick demo setup, either on your existing app or on a new Rails app.
|
|
96
|
+
Note, the best way to understand how to use ReactOnRails is to study a few simple examples. You can do a quick demo setup, either on your existing app or on a new Rails app.
|
|
86
97
|
|
|
87
|
-
1. Do the quick [tutorial](docs/tutorial
|
|
88
|
-
2. Add React on Rails to an existing Rails app per [the instructions](docs/basics/installation-into-an-existing-rails-app
|
|
89
|
-
3. Look at [spec/dummy](spec/dummy), a simple, no DB example.
|
|
98
|
+
1. Do the quick [tutorial](https://www.shakacode.com/react-on-rails/docs/basics/tutorial).
|
|
99
|
+
2. Add React on Rails to an existing Rails app per [the instructions](https://www.shakacode.com/react-on-rails/docs/basics/installation-into-an-existing-rails-app).
|
|
100
|
+
3. Look at [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy), a simple, no DB example.
|
|
90
101
|
3. Look at [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial); it's a full-featured example live at [www.reactrails.com](http://www.reactrails.com).
|
|
91
102
|
|
|
92
103
|
## Basic Installation
|
|
93
104
|
|
|
94
|
-
*See also [the instructions for installing into an existing Rails app](docs/basics/installation-into-an-existing-rails-app
|
|
105
|
+
*See also [the instructions for installing into an existing Rails app](https://www.shakacode.com/react-on-rails/docs/basics/installation-into-an-existing-rails-app).*
|
|
95
106
|
|
|
96
107
|
2. Add the `react_on_rails` gem to Gemfile:
|
|
97
108
|
|
|
@@ -115,7 +126,7 @@ Note, the best way to understand how to use ReactOnRails is to study a few simpl
|
|
|
115
126
|
|
|
116
127
|
7. Visit http://localhost:3000/hello_world.
|
|
117
128
|
|
|
118
|
-
|
|
129
|
+
|
|
119
130
|
### Turning on server rendering
|
|
120
131
|
|
|
121
132
|
With the code from running the React on Rails generator above:
|
|
@@ -138,10 +149,10 @@ issue.
|
|
|
138
149
|
|
|
139
150
|
### Configuration
|
|
140
151
|
|
|
141
|
-
* Configure `config/initializers/react_on_rails.rb`. You can adjust some necessary settings and defaults. See file [docs/basics/configuration.md](docs/basics/configuration
|
|
142
|
-
* Configure `config/webpacker.yml`. If you used the generator and the default webpacker setup, you don't need to touch this file. If you are customizing your setup, then consult the [spec/dummy/config/webpacker.yml](
|
|
152
|
+
* Configure `config/initializers/react_on_rails.rb`. You can adjust some necessary settings and defaults. See file [docs/basics/configuration.md](https://www.shakacode.com/react-on-rails/docs/basics/configuration) for documentation of all configuration options.
|
|
153
|
+
* Configure `config/webpacker.yml`. If you used the generator and the default webpacker setup, you don't need to touch this file. If you are customizing your setup, then consult the [spec/dummy/config/webpacker.yml](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy/config/webpacker.yml) example or the official default [webpacker.yml](https://github.com/rails/webpacker/blob/master/lib/install/config/webpacker.yml).
|
|
143
154
|
* Tip: set `compile: false` for development if you know that you'll always be compiling with a watch process. Otherwise, every request will check if compilation is needed.
|
|
144
|
-
* Your `public_output_path` must match your Webpack configuration for `output` of your bundles.
|
|
155
|
+
* Your `public_output_path` must match your custom Webpack configuration for `output` of your bundles.
|
|
145
156
|
* Only set `cache_manifest` to `true` in your production env.
|
|
146
157
|
|
|
147
158
|
## Including your React Component on your Rails Views
|
|
@@ -166,7 +177,7 @@ issue.
|
|
|
166
177
|
ReactOnRails.register({ HelloWorld });
|
|
167
178
|
```
|
|
168
179
|
|
|
169
|
-
Exposing your component in this way is how React on Rails is able to reference your component from a Rails view. You can expose as many components as you like, as long as their names do not collide. See below for the details of how you expose your components via the react_on_rails webpack configuration.
|
|
180
|
+
Exposing your component in this way is how React on Rails is able to reference your component from a Rails view. You can expose as many components as you like, as long as their names do not collide. See below for the details of how you expose your components via the react_on_rails webpack configuration. You may call `ReactOnRails.register` many times.
|
|
170
181
|
|
|
171
182
|
- `@some_props` can be either a hash or JSON string. This is an optional argument assuming you do not need to pass any options (if you want to pass options, such as `prerender: true`, but you do not want to pass any properties, simply pass an empty hash `{}`). This will make the data available in your component:
|
|
172
183
|
|
|
@@ -174,9 +185,9 @@ issue.
|
|
|
174
185
|
# Rails View
|
|
175
186
|
<%= react_component("HelloWorld", props: { name: "Stranger" }) %>
|
|
176
187
|
```
|
|
177
|
-
|
|
178
|
-
- This is what your HelloWorld.js file might contain. The railsContext is always available for any parameters that you _always_ want available for your React components. It has _nothing_ to do with the concept of the [React Context](https://reactjs.org/docs/context.html). See [
|
|
179
|
-
|
|
188
|
+
|
|
189
|
+
- This is what your HelloWorld.js file might contain. The railsContext is always available for any parameters that you _always_ want available for your React components. It has _nothing_ to do with the concept of the [React Context](https://reactjs.org/docs/context.html). See [Render-Functions and the RailsContext](https://www.shakacode.com/react-on-rails/docs/basics/render-functions-and-railscontext) for more details on this topic.
|
|
190
|
+
|
|
180
191
|
```js
|
|
181
192
|
import React from 'react';
|
|
182
193
|
|
|
@@ -189,35 +200,9 @@ issue.
|
|
|
189
200
|
</div>
|
|
190
201
|
);
|
|
191
202
|
};
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
See the [View Helpers API](./docs/api/view-helpers-api.md) for more details on `react_component` and its sibling function `react_component_hash`.
|
|
195
|
-
|
|
196
|
-
## Fragment Caching
|
|
197
|
-
|
|
198
|
-
Fragment caching is a [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro) feature. Fragment caching is a **HUGE** performance booster for your apps. Use the `cached_react_component` and `cached_react_component_hash`. The API is the same as `react_component` and `react_component_hash`, but for 2 differences:
|
|
199
|
-
|
|
200
|
-
1. The `cache_key` takes the same parameters as any Rails `cache` view helper.
|
|
201
|
-
1. The **props** are passed via a block so that evaluation of the props is not done unless the cache is broken. Suppose you put your props calculation into some method called `some_slow_method_that_returns_props`:
|
|
202
|
-
|
|
203
|
-
```ruby
|
|
204
|
-
<%= cached_react_component("App", cache_key: [@user, @post], prerender: true) do
|
|
205
|
-
some_slow_method_that_returns_props
|
|
206
|
-
end %>
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
Such fragment caching saves a ton of CPU work for your web server and greatly reduces the request time. It completely skips the evaluation costs of:
|
|
210
|
-
|
|
211
|
-
1. Database calls to compute the props.
|
|
212
|
-
2. Serialization the props values hash into a JSON string for evaluating JavaScript to server render.
|
|
213
|
-
3. Costs associated with evaluating JavaScript from your Ruby code.
|
|
214
|
-
4. Creating the HTML string containing the props and the server-rendered JavaScript code.
|
|
215
|
-
|
|
216
|
-
Note, even without server rendering (without step 3 above), fragment caching is still effective.
|
|
217
|
-
|
|
218
|
-
## Integration with Node.js for Server Rendering
|
|
203
|
+
```
|
|
219
204
|
|
|
220
|
-
|
|
205
|
+
See the [View Helpers API](https://www.shakacode.com/react-on-rails/docs/api/view-helpers-api) for more details on `react_component` and its sibling function `react_component_hash`.
|
|
221
206
|
|
|
222
207
|
## Globally Exposing Your React Components
|
|
223
208
|
|
|
@@ -236,7 +221,7 @@ This is how to expose a component to the `react_component` view helper.
|
|
|
236
221
|
|
|
237
222
|
#### Different Server-Side Rendering Code (and a Server-Specific Bundle)
|
|
238
223
|
|
|
239
|
-
You may want different code for your server-rendered components running server side versus client side. For example, if you have an animation that runs when a component is displayed, you might need to turn that off when server rendering. One way to handle this is conditional code like `if (window) { doClientOnlyCode() }`.
|
|
224
|
+
You may want different code for your server-rendered components running server side versus client side. For example, if you have an animation that runs when a component is displayed, you might need to turn that off when server rendering. One way to handle this is conditional code like `if (window) { doClientOnlyCode() }`.
|
|
240
225
|
|
|
241
226
|
Another way is to use a separate webpack configuration file that can use a different server side entry file, like 'serverRegistration.js' as opposed to 'clientRegistration.js.' That would set up different code for server rendering.
|
|
242
227
|
|
|
@@ -246,15 +231,15 @@ For details on techniques to use different code for client and server rendering,
|
|
|
246
231
|
|
|
247
232
|
You have two ways to specify your React components. You can either register the React component (either function or class component) directly, or you can create a function that returns a React component, which we using the name of a "render-function". Creating a render-function allows:
|
|
248
233
|
|
|
249
|
-
1. You have access to the `railsContext`. See documentation for the railsContext in terms of why you might need it. You **need** a
|
|
234
|
+
1. You to have access to the `railsContext`. See [documentation for the railsContext](https://www.shakacode.com/react-on-rails/docs/basics/render-functions-and-railscontext) in terms of why you might need it. You **need** a Render-Function to access the `railsContext`.
|
|
250
235
|
2. You can use the passed-in props to initialize a redux store or set up react-router.
|
|
251
236
|
3. You can return different components depending on what's in the props.
|
|
252
237
|
|
|
253
|
-
Note, the return value of a **
|
|
238
|
+
Note, the return value of a **Render-Function** should be either a React Function or Class Component, or an object representing server rendering results.
|
|
254
239
|
|
|
255
240
|
Do not return a React Element (JSX).
|
|
256
241
|
|
|
257
|
-
ReactOnRails will automatically detect a registered
|
|
242
|
+
ReactOnRails will automatically detect a registered Render-Function by the fact that the function takes
|
|
258
243
|
more than 1 parameter. In other words, if you want the ability to provide a function that returns the
|
|
259
244
|
React component, then you need to specify at least a second parameter. This is the `railsContext`.
|
|
260
245
|
If you're not using this parameter, declare your function with the unused param:
|
|
@@ -268,19 +253,19 @@ const MyComponentGenerator = (props, _railsContext) => {
|
|
|
268
253
|
}
|
|
269
254
|
```
|
|
270
255
|
|
|
271
|
-
Thus, there is no difference between registering a React
|
|
256
|
+
Thus, there is no difference between registering a React Function Component or class Component versus a "Render-Function." Just call `ReactOnRails.register`.
|
|
272
257
|
|
|
273
|
-
## react_component_hash for
|
|
258
|
+
## react_component_hash for Render-Functions
|
|
274
259
|
|
|
275
|
-
Another reason to use a
|
|
260
|
+
Another reason to use a Render-Function is that sometimes in server rendering, specifically with React Router, you need to return the result of calling ReactDOMServer.renderToString(element). You can do this by returning an object with the following shape: { renderedHtml, redirectLocation, error }. Make sure you use this function with `react_component_hash`.
|
|
276
261
|
|
|
277
|
-
For server rendering, if you wish to return multiple HTML strings from a
|
|
262
|
+
For server rendering, if you wish to return multiple HTML strings from a Render-Function, you may return an Object from your Render-Function with a single top-level property of `renderedHtml`. Inside this Object, place a key called `componentHtml`, along with any other needed keys. An example scenario of this is when you are using side effects libraries like [React Helmet](https://github.com/nfl/react-helmet). Your Ruby code will get this Object as a Hash containing keys componentHtml and any other custom keys that you added:
|
|
278
263
|
|
|
279
264
|
```js
|
|
280
265
|
{ renderedHtml: { componentHtml, customKey1, customKey2} }
|
|
281
266
|
```
|
|
282
267
|
|
|
283
|
-
For details on using react_component_hash with react-helmet, see
|
|
268
|
+
For details on using react_component_hash with react-helmet, see [our react-helmet documentation](https://www.shakacode.com/react-on-rails/docs/additional-reading/react-helmet).
|
|
284
269
|
|
|
285
270
|
## Error Handling
|
|
286
271
|
|
|
@@ -290,20 +275,19 @@ For details on using react_component_hash with react-helmet, see the docs below
|
|
|
290
275
|
## I18n
|
|
291
276
|
|
|
292
277
|
React on Rails provides an option for automatic conversions of Rails `*.yml` locale files into `*.json` or `*.js*.
|
|
293
|
-
See the [How to add I18n](docs/basics/i18n
|
|
278
|
+
See the [How to add I18n](https://www.shakacode.com/react-on-rails/docs/basics/i18n) for a summary of adding I18n.
|
|
294
279
|
|
|
295
280
|
## More Details
|
|
296
281
|
|
|
297
|
-
Browse the links in the [Summary Table of Contents](
|
|
282
|
+
Browse the links in the [Summary Table of Contents](https://github.com/shakacode/react_on_rails/tree/master/SUMMARY.md)
|
|
298
283
|
|
|
299
284
|
Here are some highly recommended next articles to read:
|
|
300
285
|
|
|
301
|
-
1. [How React on Rails Works](docs/
|
|
302
|
-
1. [
|
|
303
|
-
1. [
|
|
304
|
-
1. [View Helpers API](./docs/api/view-helpers-api.md)
|
|
286
|
+
1. [How React on Rails Works](https://www.shakacode.com/react-on-rails/docs/basics/how-react-on-rails-works)
|
|
287
|
+
1. [Webpack Configuration](https://www.shakacode.com/react-on-rails/docs/basics/webpack-configuration)
|
|
288
|
+
1. [View Helpers API](https://www.shakacode.com/react-on-rails/docs/api/view-helpers-api)
|
|
305
289
|
1. [Caching and Performance: React on Rails Pro](https://www.shakacode.com/react-on-rails-pro).
|
|
306
|
-
1. [Deployment](docs/basics/deployment
|
|
290
|
+
1. [Deployment](https://www.shakacode.com/react-on-rails/docs/basics/deployment).
|
|
307
291
|
|
|
308
292
|
# Support
|
|
309
293
|
|
|
@@ -319,38 +303,64 @@ Please [**click to subscribe**](https://app.mailerlite.com/webforms/landing/l1d9
|
|
|
319
303
|
- **[forum.shakacode.com](https://forum.shakacode.com)**: Post your questions
|
|
320
304
|
- **[@railsonmaui on Twitter](https://twitter.com/railsonmaui)**
|
|
321
305
|
- For a live, [open source](https://github.com/shakacode/react-webpack-rails-tutorial), example of this gem, see [www.reactrails.com](http://www.reactrails.com).
|
|
322
|
-
- See [Projects](PROJECTS.md) using and [KUDOS](
|
|
323
|
-
- *See [NEWS.md](NEWS.md) for more notes over time.*
|
|
306
|
+
- See [Projects](https://github.com/shakacode/react_on_rails/tree/master/PROJECTS.md) using and [KUDOS](https://github.com/shakacode/react_on_rails/tree/master/KUDOS.md) for React on Rails. Please submit yours! Please edit either page or [email us](mailto:contact@shakacode.com) and we'll add your info. We also **love stars** as it helps us attract new users and contributors.
|
|
307
|
+
- *See [NEWS.md](https://github.com/shakacode/react_on_rails/tree/master/NEWS.md) for more notes over time.*
|
|
324
308
|
|
|
325
309
|
## Contributing
|
|
326
310
|
|
|
327
|
-
Bug reports and pull requests are welcome. See [Contributing](CONTRIBUTING.md) to get started, and the [list of help wanted issues](https://github.com/shakacode/react_on_rails/labels/contributions%3A%20up%20for%20grabs%21).
|
|
311
|
+
Bug reports and pull requests are welcome. See [Contributing](https://github.com/shakacode/react_on_rails/tree/master/CONTRIBUTING.md) to get started, and the [list of help wanted issues](https://github.com/shakacode/react_on_rails/labels/contributions%3A%20up%20for%20grabs%21).
|
|
328
312
|
|
|
329
313
|
## React on Rails Pro
|
|
330
314
|
|
|
331
|
-
React on Rails Pro
|
|
315
|
+
Support React on Rails Pro development [by becoming a Github sponsor](https://github.com/sponsors/shakacode) and get these benefits.
|
|
332
316
|
|
|
333
|
-
|
|
317
|
+
React on Rails Pro includes Node server rendering, fragment caching, code-splitting, and other performance enhancements for React on Rails. For a case study, see the article [HVMN’s 90% Reduction in Server Response Time from React on Rails Pro](https://www.shakacode.com/blog/hvmns-90-reduction-in-server-response-time-from-react-on-rails-pro/). The [Wiki](https://github.com/shakacode/react_on_rails/wiki) contains more details.
|
|
334
318
|
|
|
335
|
-
|
|
319
|
+
[](https://blog.shakacode.com/hvmns-90-reduction-in-server-response-time-from-react-on-rails-pro-eb08226687db)
|
|
336
320
|
|
|
337
321
|
The [React on Rails Pro Support Plan](https://www.shakacode.com/react-on-rails-pro) can help!
|
|
338
322
|
|
|
339
|
-
* Optimizing your webpack setup to Webpack
|
|
340
|
-
* Upgrading your app to use the current
|
|
323
|
+
* Optimizing your webpack setup to the latest Webpack for React on Rails including code splitting with loadable-components.
|
|
324
|
+
* Upgrading your app to use the current `rails/webpacker` setup that skips the Sprockets asset pipeline.
|
|
341
325
|
* Better performance client and server side.
|
|
342
|
-
* Best practices based on over
|
|
326
|
+
* Best practices based on over 6 years of React on Rails experience on many production projects.
|
|
343
327
|
* Using [Reason](https://reasonml.github.io/) with (or without) React on Rails.
|
|
344
328
|
|
|
345
|
-
ShakaCode can also help you with your custom software development needs. We specialize in marketplace and e-commerce applications that utilize both Rails and React. Because we own [
|
|
329
|
+
ShakaCode can also help you with your custom software development needs. We specialize in marketplace and e-commerce applications that utilize both Rails and React. Because we own [HiChee.com](https://hichee.com), we can leverage that code for your app!
|
|
346
330
|
|
|
347
331
|
Please email Justin Gordon [justin@shakacode.com](mailto:justin@shakacode.com), the maintainer of React on Rails, for more information.
|
|
348
332
|
|
|
333
|
+
### Pro: Fragment Caching
|
|
334
|
+
|
|
335
|
+
Fragment caching is a [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro) feature. Fragment caching is a **HUGE** performance booster for your apps. Use the `cached_react_component` and `cached_react_component_hash`. The API is the same as `react_component` and `react_component_hash`, but for 2 differences:
|
|
336
|
+
|
|
337
|
+
1. The `cache_key` takes the same parameters as any Rails `cache` view helper.
|
|
338
|
+
1. The **props** are passed via a block so that evaluation of the props is not done unless the cache is broken. Suppose you put your props calculation into some method called `some_slow_method_that_returns_props`:
|
|
339
|
+
|
|
340
|
+
```ruby
|
|
341
|
+
<%= cached_react_component("App", cache_key: [@user, @post], prerender: true) do
|
|
342
|
+
some_slow_method_that_returns_props
|
|
343
|
+
end %>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Such fragment caching saves CPU work for your web server and greatly reduces the request time. It completely skips the evaluation costs of:
|
|
347
|
+
|
|
348
|
+
1. Database calls to compute the props.
|
|
349
|
+
2. Serialization the props values hash into a JSON string for evaluating JavaScript to server render.
|
|
350
|
+
3. Costs associated with evaluating JavaScript from your Ruby code.
|
|
351
|
+
4. Creating the HTML string containing the props and the server-rendered JavaScript code.
|
|
352
|
+
|
|
353
|
+
Note, even without server rendering (without step 3 above), fragment caching is still effective.
|
|
354
|
+
|
|
355
|
+
### Pro: Integration with Node.js for Server Rendering
|
|
356
|
+
|
|
357
|
+
Default server rendering is done by ExecJS. If you want to use a Node.js server for better performing server rendering, [email justin@shakacode.com](mailto:justin@shakacode.com). ShakaCode has built a premium Node rendering server that is part of [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro).
|
|
358
|
+
|
|
349
359
|
## Testimonials for ShakaCode
|
|
350
|
-
[HVMN Testimonial, by Paul Benigeri, October 12, 2018](
|
|
360
|
+
[HVMN Testimonial, by Paul Benigeri, October 12, 2018](https://www.shakacode.com/react-on-rails/docs/testimonials/hvmn)
|
|
351
361
|
> The price we paid for the consultation + the React on Rails pro license has already been made back a couple of times from hosting fees alone. The entire process was super hands off, and our core team was able to focus on shipping new feature during that sprint.
|
|
352
362
|
|
|
353
|
-
[ResortPass Testimonial, by Leora Juster, December 10, 2018](
|
|
363
|
+
[ResortPass Testimonial, by Leora Juster, December 10, 2018](https://www.shakacode.com/react-on-rails/docs/testimonials/resortpass)
|
|
354
364
|
|
|
355
365
|
> Justin and his team were instrumental in assisting us in setting design foundations and standards for our transition to a react on rails application. Just three months of work with the team at Shaka code and we have a main page of our application server-side rendering at exponentially improved speeds.
|
|
356
366
|
|
|
@@ -358,16 +368,17 @@ From Joel Hooks, Co-Founder, Chief Nerd at [egghead.io](https://egghead.io/), Ja
|
|
|
358
368
|
|
|
359
369
|

|
|
360
370
|
|
|
361
|
-
For more testimonials, see [Live Projects](PROJECTS.md) and [Kudos](
|
|
371
|
+
For more testimonials, see [Live Projects](https://github.com/shakacode/react_on_rails/tree/master/PROJECTS.md) and [Kudos](https://github.com/shakacode/react_on_rails/tree/master/KUDOS.md).
|
|
362
372
|
|
|
363
373
|
# Supporters
|
|
364
374
|
|
|
365
|
-
The following companies support this open source project, and ShakaCode uses their products! Justin writes React on Rails on [RubyMine](https://www.jetbrains.com/ruby/). We use [Scout](https://scoutapp.com/) to monitor the live performance of [
|
|
375
|
+
The following companies support this open source project, and ShakaCode uses their products! Justin writes React on Rails on [RubyMine](https://www.jetbrains.com/ruby/). We use [Scout](https://scoutapp.com/) to monitor the live performance of [HiChee.com](https://HiChee.com), [Rails AutoScale](https://railsautoscale.com) to scale the dynos of HiChee, [BrowserStack](https://www.browserstack.com) to solve problems with oddball browsers.
|
|
366
376
|
|
|
367
377
|
[](https://www.jetbrains.com/ruby/)
|
|
368
378
|
[](https://scoutapp.com/)
|
|
379
|
+
[](https://railsautoscale.com/)
|
|
369
380
|
[](https://www.browserstack.com)
|
|
370
|
-
|
|
381
|
+
|
|
371
382
|
|
|
372
383
|
## Clubhouse
|
|
373
384
|
I've just moved ShakaCode's development to [ClubHouse](https://clubhouse.io/) from Trello. We're going to be doing this with all our projects. If you want to **try ClubHouse and get 2 months free beyond the 14-day trial period**, click [here to use ShakaCode's referral code](http://r.clbh.se/mvfoNeH). We're participating in their awesome triple-sided referral program, which you can read about [here](https://clubhouse.io/blog/clubhouse-referral-program-5f614bb437c3). By using our [referral code](http://r.clbh.se/mvfoNeH) you'll be supporting ShakaCode and, thus, React on Rails!
|
|
@@ -377,8 +388,8 @@ I've just moved ShakaCode's development to [ClubHouse](https://clubhouse.io/) fr
|
|
|
377
388
|
Aloha and best wishes from Justin and the ShakaCode team!
|
|
378
389
|
|
|
379
390
|
# Work with Us
|
|
380
|
-
ShakaCode is **[currently looking to hire](http://www.shakacode.com/about/#work-with-us)** like-minded, remote-first, developers that wish to work on our projects, including [
|
|
391
|
+
ShakaCode is **[currently looking to hire](http://www.shakacode.com/about/#work-with-us)** like-minded, remote-first, developers that wish to work on our projects, including [HiChee](https://hichee.com). Your main coding interview will be pairing with us on our open source! We're also using [ReasonML](https://reasonml.github.io/) extensively!
|
|
381
392
|
|
|
382
393
|
# License
|
|
383
394
|
|
|
384
|
-
The gem is available as open source under the terms of the [MIT License](LICENSE.md).
|
|
395
|
+
The gem is available as open source under the terms of the [MIT License](https://github.com/shakacode/react_on_rails/tree/master/LICENSE.md).
|
data/SUMMARY.md
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
+ [How React on Rails Works](docs/outdated/how-react-on-rails-works.md)
|
|
9
9
|
+ [Client vs. Server Rendering](./docs/basics/client-vs-server-rendering.md)
|
|
10
10
|
+ [React Server Rendering](./docs/basics/react-server-rendering.md)
|
|
11
|
-
+ [Recommended Project Structure](./docs/basics/recommended-project-structure.md)
|
|
12
11
|
+ [Render-Functions and the RailsContext](docs/basics/render-functions-and-railscontext.md)
|
|
13
12
|
+ [Caching and Performance: React on Rails Pro](https://github.com/shakacode/react_on_rails/wiki).
|
|
14
13
|
+ [Deployment](docs/basics/deployment.md).
|
|
@@ -28,6 +27,7 @@
|
|
|
28
27
|
+ [Updating Dependencies](./docs/additional-reading/updating-dependencies.md)
|
|
29
28
|
+ [Manual Installation Overview](docs/outdated/manual-installation-overview.md)
|
|
30
29
|
+ [Upgrading from rails/webpacker v3 to v4](docs/additional-reading/upgrade-webpacker-v3-to-v4.md)
|
|
30
|
+
+ [Recommended Project Structure](docs/additional-reading/recommended-project-structure.md)
|
|
31
31
|
|
|
32
32
|
## **Rails**
|
|
33
33
|
+ [Rails Engine Integration](./docs/additional-reading/rails-engine-integration.md)
|
|
@@ -35,13 +35,9 @@ can pass the redux option if you'd like to have redux setup for you automaticall
|
|
|
35
35
|
Then you may run
|
|
36
36
|
|
|
37
37
|
`rails s`
|
|
38
|
-
|
|
39
|
-
More Details:
|
|
40
|
-
|
|
41
|
-
`https://github.com/shakacode/react_on_rails/blob/master/docs/basics/generator-details.md`
|
|
42
38
|
```
|
|
43
39
|
|
|
44
|
-
Another good option is to create a simple test app per the [Tutorial](
|
|
40
|
+
Another good option is to create a simple test app per the [Tutorial](https://www.shakacode.com/react-on-rails/docs/basics/tutorial).
|
|
45
41
|
|
|
46
42
|
# Understanding the Organization of the Generated Client Code
|
|
47
43
|
The generated client code follows our organization scheme. Each unique set of functionality, is given its own folder inside of `app/javascript/app/bundles`. Note, the recommended for bigger projects is `client/app/bundles`. This encourages for modularity of *domains*.
|
|
@@ -58,4 +54,3 @@ You may also notice the `app/lib` folder. This is for any code that is common be
|
|
|
58
54
|
If you have used the `--redux` generator option, you will notice the familiar additional redux folders in addition to the aforementioned folders. The Hello World example has also been modified to use Redux.
|
|
59
55
|
|
|
60
56
|
Note the organizational paradigm of "bundles". These are like application domains and are used for grouping your code into webpack bundles, in case you decide to create different bundles for deployment. This is also useful for separating out logical parts of your application. The concept is that each bundle will have it's own Redux store. If you have code that you want to reuse across bundles, including components and reducers, place them under `/client/app/lib`.
|
|
61
|
-
|