react_on_rails 12.3.0 → 12.4.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +12 -10
  3. data/CHANGELOG.md +21 -15
  4. data/NEWS.md +9 -3
  5. data/README.md +12 -308
  6. data/SUMMARY.md +12 -12
  7. data/docs/additional-details/generator-details.md +1 -1
  8. data/docs/additional-details/manual-installation-overview.md +2 -2
  9. data/docs/api/view-helpers-api.md +4 -4
  10. data/docs/contributor-info/linters.md +1 -1
  11. data/docs/contributor-info/pull-requests.md +1 -1
  12. data/docs/{basics → guides}/client-vs-server-rendering.md +1 -1
  13. data/docs/{basics → guides}/configuration.md +0 -0
  14. data/docs/{basics → guides}/deployment.md +1 -1
  15. data/docs/guides/getting-started.md +183 -0
  16. data/docs/{basics → guides}/hmr-and-hot-reloading-with-the-webpack-dev-server.md +0 -0
  17. data/docs/{basics → guides}/how-react-on-rails-works.md +3 -1
  18. data/docs/guides/how-to-conditionally-server-render-based-on-device-type.md +39 -0
  19. data/docs/guides/how-to-use-different-files-for-client-and-server-rendering.md +98 -0
  20. data/docs/{basics → guides}/i18n.md +0 -0
  21. data/docs/{basics → guides}/installation-into-an-existing-rails-app.md +3 -3
  22. data/docs/{basics → guides}/minitest-configuration.md +0 -0
  23. data/docs/{rails-webpacker-react-integration-options.md → guides/rails-webpacker-react-integration-options.md} +1 -1
  24. data/docs/guides/react-on-rails-overview.md +30 -0
  25. data/docs/{basics → guides}/react-server-rendering.md +2 -2
  26. data/docs/{basics → guides}/render-functions-and-railscontext.md +0 -0
  27. data/docs/{basics → guides}/rspec-configuration.md +2 -2
  28. data/docs/{basics → guides}/tutorial.md +2 -4
  29. data/docs/{basics → guides}/upgrading-react-on-rails.md +1 -1
  30. data/docs/{basics → guides}/webpack-configuration.md +1 -1
  31. data/docs/home.md +19 -378
  32. data/docs/javascript/code-splitting.md +2 -2
  33. data/docs/misc/articles.md +1 -1
  34. data/docs/misc/doctrine.md +3 -3
  35. data/docs/outdated/rails-assets-relative-paths.md +2 -2
  36. data/docs/outdated/rails-assets.md +1 -1
  37. data/docs/rails/convert-rails-5-api-only-app.md +1 -1
  38. data/docs/rails/rails-engine-integration.md +3 -12
  39. data/docs/react-on-rails-pro/react-on-rails-pro.md +43 -0
  40. data/docs/testimonials/testimonials.md +4 -4
  41. data/lib/react_on_rails/helper.rb +6 -0
  42. data/lib/react_on_rails/locales/base.rb +7 -12
  43. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +9 -0
  44. data/lib/react_on_rails/version.rb +1 -1
  45. data/lib/tasks/assets.rake +3 -1
  46. data/package.json +1 -1
  47. metadata +24 -19
@@ -0,0 +1,183 @@
1
+ # Getting Started
2
+
3
+ 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.
4
+
5
+ 1. Do the quick [tutorial](https://www.shakacode.com/react-on-rails/docs/guides/tutorial/).
6
+ 2. Add React on Rails to an existing Rails app per [the instructions](https://www.shakacode.com/react-on-rails/docs/guides/installation-into-an-existing-rails-app/).
7
+ 3. Look at [spec/dummy](https://github.com/shakacode/react_on_rails/tree/master/spec/dummy), a simple, no DB example.
8
+ 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://reactrails.com).
9
+
10
+ ## Basic Installation
11
+
12
+ *See also [the instructions for installing into an existing Rails app](https://www.shakacode.com/react-on-rails/docs/guides/installation-into-an-existing-rails-app/).*
13
+
14
+ 1. Add the `react_on_rails` gem to Gemfile:
15
+
16
+ ```bash
17
+ bundle add react_on_rails --strict
18
+ ```
19
+
20
+ 2. Commit this to git (or else you cannot run the generator unless you pass the option `--ignore-warnings`).
21
+
22
+ 3. Run the generator:
23
+
24
+ ```bash
25
+ rails generate react_on_rails:install
26
+ ```
27
+
28
+ 4. Start the app:
29
+
30
+ ```bash
31
+ rails s
32
+ ```
33
+
34
+ 5. Visit http://localhost:3000/hello_world.
35
+
36
+
37
+ ### Turning on server rendering
38
+
39
+ With the code from running the React on Rails generator above:
40
+
41
+ 1. Edit `app/views/hello_world/index.html.erb` and set the `prerender` option to `true`.
42
+ 2. Refresh the page.
43
+
44
+ Below is the line where you turn server rendering on by setting `prerender` to true:
45
+
46
+ ```erb
47
+ <%= react_component("HelloWorld", props: @hello_world_props, prerender: false) %>
48
+ ```
49
+
50
+ Note, if you got an error in your console regarding "ReferenceError: window is not defined",
51
+ then you need to edit `config/webpacker.yml` and set `hmr: false` and `inline: false`.
52
+ See [rails/webpacker PR 2644](https://github.com/rails/webpacker/pull/2644) for a fix for this
53
+ issue.
54
+
55
+ ## Basic Usage
56
+
57
+ ### Configuration
58
+
59
+ * 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/guides/configuration/) for documentation of all configuration options.
60
+ * 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).
61
+ * Most apps should rely on the rails/webpacker setup for Webpack. v6 of rails/webpacker includes support for v5 of webpack.
62
+
63
+ ## Including your React Component on your Rails Views
64
+
65
+ - React component are rendered via your Rails Views. Here's an ERB sample:
66
+
67
+ ```erb
68
+ <%= react_component("HelloWorld", props: @some_props) %>
69
+ ```
70
+
71
+ - **Server-Side Rendering**: Your react component is first rendered into HTML on the server. Use the **prerender** option:
72
+
73
+ ```erb
74
+ <%= react_component("HelloWorld", props: @some_props, prerender: true) %>
75
+ ```
76
+
77
+ - The `component_name` parameter is a string matching the name you used to expose your React component globally. So, in the above examples, if you had a React component named "HelloWorld", you would register it with the following lines:
78
+
79
+ ```js
80
+ import ReactOnRails from 'react-on-rails';
81
+ import HelloWorld from './HelloWorld';
82
+ ReactOnRails.register({ HelloWorld });
83
+ ```
84
+
85
+ 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.
86
+
87
+ - `@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:
88
+
89
+ ```ruby
90
+ # Rails View
91
+ <%= react_component("HelloWorld", props: { name: "Stranger" }) %>
92
+ ```
93
+
94
+ - 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/guides/render-functions-and-railscontext/) for more details on this topic.
95
+
96
+ ```js
97
+ import React from 'react';
98
+
99
+ export default (props, railsContext) => {
100
+ // Note wrap in a function to make this a React function component
101
+ return () => (
102
+ <div>
103
+ Your locale is {railsContext.i18nLocale}.<br/>
104
+ Hello, {props.name}!
105
+ </div>
106
+ );
107
+ };
108
+ ```
109
+
110
+ 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`.
111
+
112
+ ## Globally Exposing Your React Components
113
+
114
+ For the React on Rails view helper `react_component` to use your React components, you will have to **register** them in your JavaScript code.
115
+
116
+ Use modules just as you would when using Webpack and React without Rails. The difference is that instead of mounting React components directly to an element using `React.render`, you **register your components to ReactOnRails and then mount them with helpers inside of your Rails views**.
117
+
118
+ This is how to expose a component to the `react_component` view helper.
119
+
120
+ ```javascript
121
+ // app/javascript/packs/hello-world-bundle.js
122
+ import HelloWorld from '../components/HelloWorld';
123
+ import ReactOnRails from 'react-on-rails';
124
+ ReactOnRails.register({ HelloWorld });
125
+ ```
126
+
127
+ #### Different Server-Side Rendering Code (and a Server-Specific Bundle)
128
+
129
+ 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() }`.
130
+
131
+ 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.
132
+
133
+ For details on techniques to use different code for client and server rendering, see: [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). (_Requires creating a free account._)
134
+
135
+ ## Specifying Your React Components: Register directly or use render-functions
136
+
137
+ 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:
138
+
139
+ 1. You to have access to the `railsContext`. See [documentation for the railsContext](https://www.shakacode.com/react-on-rails/docs/guides/render-functions-and-railscontext/) in terms of why you might need it. You **need** a Render-Function to access the `railsContext`.
140
+ 2. You can use the passed-in props to initialize a redux store or set up react-router.
141
+ 3. You can return different components depending on what's in the props.
142
+
143
+ Note, the return value of a **Render-Function** should be either a React Function or Class Component, or an object representing server rendering results.
144
+
145
+ **Do not return a React Element (JSX).**
146
+
147
+ ReactOnRails will automatically detect a registered Render-Function by the fact that the function takes
148
+ more than 1 parameter. In other words, if you want the ability to provide a function that returns the
149
+ React component, then you need to specify at least a second parameter. This is the `railsContext`.
150
+ If you're not using this parameter, declare your function with the unused param:
151
+
152
+ ```js
153
+ const MyComponentGenerator = (props, _railsContext) => {
154
+ if (props.print) {
155
+ // This is a React FunctionComponent because it is wrapped in a function.
156
+ return () => <H1>{JSON.stringify(props)}</H1>;
157
+ }
158
+ }
159
+ ```
160
+
161
+ Thus, there is no difference between registering a React Function Component or class Component versus a "Render-Function." Just call `ReactOnRails.register`.
162
+
163
+ ## react_component_hash for Render-Functions
164
+
165
+ 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`.
166
+
167
+ 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:
168
+
169
+ ```js
170
+ { renderedHtml: { componentHtml, customKey1, customKey2} }
171
+ ```
172
+
173
+ 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/).
174
+
175
+ ## Error Handling
176
+
177
+ * All errors from ReactOnRails will be of type ReactOnRails::Error.
178
+ * Prerendering (server rendering) errors get context information for HoneyBadger and Sentry for easier debugging.
179
+
180
+ ## I18n
181
+
182
+ React on Rails provides an option for automatic conversions of Rails `*.yml` locale files into `*.json` or `*.js*.
183
+ See the [How to add I18n](https://www.shakacode.com/react-on-rails/docs/guides/i18n/) for a summary of adding I18n.
@@ -36,8 +36,10 @@ On production deployments that use asset precompilation, such as Heroku deployme
36
36
 
37
37
  However, if you want to run a custom command to run webpack to build your bundles, then you will:
38
38
  1. Ensure you do not have a `config/webpack/production.js` file
39
- 1. Define `config.build_production_command` in your [config/initializers/react_on_rails.rb](https://www.shakacode.com/react-on-rails/docs/basics/configuration)
39
+ 1. Define `config.build_production_command` in your [config/initializers/react_on_rails.rb](https://www.shakacode.com/react-on-rails/docs/guides/configuration/)
40
40
 
41
41
  Then React on Rails modifies the `assets:precompile` task to run your `build_production_command`.
42
42
 
43
43
  If you have used the provided generator, these bundles will automatically be added to your `.gitignore` to prevent extraneous noise from re-generated code in your pull requests. You will want to do this manually if you do not use the provided generator.
44
+
45
+ You can stop React on Rails from modifying or creating the `assets:precompile` task, by setting a `REACT_ON_RAILS_PRECOMPILE` environment variable to `no`, `false`, `n` or `f`.
@@ -0,0 +1,39 @@
1
+ # How to conditionally render server side based on the device type
2
+
3
+ In general, we want to use CSS to do mobile responsive layouts.
4
+
5
+ However, sometimes we want to have layouts sufficiently different that we can't do this via CSS. If we didn't do server rendering, we can check the device type on the client side. However, if we're doing server rendering, we need to send this data to the client code from the Rails server so that the server rendering can account for this.
6
+
7
+ Here's an example:
8
+
9
+ ## config/initializers/react_on_rails.rb
10
+ ```ruby
11
+ module RenderingExtension
12
+ # Return a Hash that contains custom values from the view context that will get passed to
13
+ # all calls to react_component and redux_store for rendering
14
+ def self.custom_context(view_context)
15
+ if view_context.controller.is_a?(ActionMailer::Base)
16
+ {}
17
+ else
18
+ {
19
+ desktop: !(view_context.browser.device.tablet? || view_context.browser.device.mobile?),
20
+ tablet: view_context.browser.device.tablet?,
21
+ mobile: view_context.browser.device.mobile? || false
22
+ }
23
+ end
24
+ end
25
+ end
26
+
27
+ # Shown below are the defaults for configuration
28
+ ReactOnRails.configure do |config|
29
+ # See https://github.com/shakacode/react_on_rails/blob/master/docs/guides/configuration.md for the rest
30
+
31
+ # This allows you to add additional values to the Rails Context. Implement one static method
32
+ # called `custom_context(view_context)` and return a Hash.
33
+ config.rendering_extension = RenderingExtension
34
+ end
35
+ ```
36
+
37
+ Note, full details of the React on Rails confguration are [here in docs/basics/configuration.md](https://shakacode.com/react-on-rails/docs/guides/configuration/).
38
+
39
+ See the doc file [docs/basics/generator-functions-and-railscontext.md](https://shakacode.com/react-on-rails/docs/guides/generator-functions-and-railscontext/#rails-context) for how your client-side code uses the device information
@@ -0,0 +1,98 @@
1
+ ## How to use different versions of a file for client and server rendering
2
+
3
+ There are 3 main ways to use different code for server vs. client rendering.
4
+
5
+ ## A. Using different Entry Points
6
+ Many projects will have different entry points for client and server rendering. This only works for a top-level entry point such as the entry point for a react-router app component.
7
+
8
+ Your Client Entry can look like this:
9
+
10
+ ```js
11
+ import ReactOnRails from 'react-on-rails';
12
+ import App from './ClientApp';
13
+ ReactOnRails.register({ App })
14
+ ```
15
+
16
+ So your Server Entry can look like:
17
+
18
+ ```js
19
+ import ReactOnRails from 'react-on-rails';
20
+ import App from './ServerApp';
21
+ ReactOnRails.register({ App })
22
+ ```
23
+
24
+ Note that the only difference is on the second line of each of these examples.
25
+
26
+ ## B. Two Options for Using Webpack Resolve Alias in the Webpack Config
27
+ Per [Webpack Docs](https://webpack.js.org/configuration/resolve/#resolve-alias).
28
+
29
+ ### 1. Update `webpack/set-resolve.js` to have a different resolution for the exact file:
30
+
31
+ ```js
32
+ function setResolve(builderConfig, webpackConfig) {
33
+
34
+ // Use a different resolution for Client and Server file
35
+ let SomeJsFile;
36
+ if (builderConfig.serverRendering) {
37
+ SomeJsFile = path.resolve(__dirname, "../bundles/SomeJsFileServer");
38
+ } else {
39
+ SomeJsFile = path.resolve(__dirname, "../bundles/SomeJsFileClient");
40
+ }
41
+
42
+ const resolve = {
43
+ alias: {
44
+ ... // blah blah
45
+ SomeJsFile,
46
+ ... // blah blah
47
+ },
48
+ ```
49
+
50
+ Then you have this import:
51
+
52
+ ```js
53
+ import SomeJsFile from 'SomeJsFile';
54
+ ```
55
+
56
+ ### 2. Use a different resolution for the right directory of client or server files:
57
+
58
+ #### a. Update `webpack/set-resolve.js` to have something like:
59
+ ```js
60
+ function setResolve(builderConfig, webpackConfig) {
61
+
62
+ // Use a different resolution for Client and Server file
63
+ let variant;
64
+ if (builderConfig.serverRendering) {
65
+ variant = path.resolve(__dirname, "../bundles/variant/ClientOnly");
66
+ } else {
67
+ variant = path.resolve(__dirname, "../bundles/variant/serverOnly");
68
+ }
69
+
70
+ const resolve = {
71
+ alias: {
72
+ ... // blah blah
73
+ variant
74
+ ... // blah blah
75
+ },
76
+ ```
77
+
78
+ #### b. Add different versions of the file to the `bundles/variant/ClientOnly` and `bundles/variant/ServerOnly` directories
79
+
80
+ #### c. Use the `variant` in import in a file that can be used both for client and server rendering:
81
+
82
+ ```js
83
+ import SomeJsFile from 'variant/SomeJsFile';
84
+ import AnotherJsFile from 'variant/AnotherJsFile';
85
+ ```
86
+
87
+ ## C. Conditional code that can check if `window` is defined.
88
+
89
+ This is probably the ugliest and hackiest way to do this, but it's quick! Essentially you wrap code that cannot execute server side in a conditional:
90
+
91
+ ```js
92
+ if (window) { // window should be falsy on the server side
93
+ doSomethingClientOnly();
94
+
95
+ // or do an import
96
+ const foobar = require('foobar').default;
97
+ }
98
+ ```
File without changes
@@ -1,8 +1,8 @@
1
1
  # Getting Started with an existing Rails app
2
2
 
3
- **Also consult the instructions for installing on a fresh Rails app**, see the [React on Rails Basic Tutorial](https://www.shakacode.com/react-on-rails/docs/basics/tutorial).
3
+ **Also consult the instructions for installing on a fresh Rails app**, see the [React on Rails Basic Tutorial](https://www.shakacode.com/react-on-rails/docs/guides/tutorial/).
4
4
 
5
- **If you have rails-5 API only project**, first [convert the rails-5 API only app to rails app](#convert-rails-5-api-only-app-to-rails-app) before [getting started](#getting-started-with-an-existing-rails-app).
5
+ **If you have rails-5 API only project**, first [convert the rails-5 API only app to rails app](https://www.shakacode.com/react-on-rails/docs/rails/convert-rails-5-api-only-app-to-rails-app/).
6
6
 
7
7
  1. Add the following to your Gemfile and `bundle install`. We recommend fixing the version of React on Rails, as you will need to keep the exact version in sync with the version in your `package.json` file.
8
8
 
@@ -52,7 +52,7 @@ bundle add react_on_rails --version=12.0.4 --strict
52
52
 
53
53
  ## Installation
54
54
 
55
- See the [Installation Overview](https://www.shakacode.com/react-on-rails/docs/additional-details/manual-installation-overview) for a concise set summary of what's in a React on Rails installation.
55
+ See the [Installation Overview](https://www.shakacode.com/react-on-rails/docs/additional-details/manual-installation-overview/) for a concise set summary of what's in a React on Rails installation.
56
56
 
57
57
 
58
58
  ## NPM
File without changes
@@ -13,7 +13,7 @@ These gems provide advanced integration of React with [rails/webpacker](https://
13
13
  | [react-rails](https://github.com/reactjs/react-rails) | ✅ | ✅ | | | | | |
14
14
  | [webpacker-react](https://github.com/renchap/webpacker-react) | ✅ | | | | | | |
15
15
 
16
- Note, Node SSR for React on Rails requires [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro).
16
+ Note, Node SSR for React on Rails requires [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/).
17
17
 
18
18
  ---
19
19
 
@@ -0,0 +1,30 @@
1
+ # React on Rails
2
+
3
+ React on Rails integrates Rails with (server rendering of) Facebook's [React](https://github.com/facebook/react) front-end framework.
4
+
5
+ ---
6
+
7
+ # Project Objective
8
+
9
+ 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.
10
+
11
+ # Features and Why React on Rails?
12
+
13
+ Given that [`rails/webpacker`](https://github.com/rails/webpacker/) gem already provides basic React integration, why would you use "React on Rails"?
14
+
15
+ 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.
16
+ 1. Tight integration with [rails/webpacker](https://github.com/rails/webpacker).
17
+ 1. Server-Side Rendering (SSR), often used for SEO crawler indexing and UX performance, is not offered by `rails/webpacker`.
18
+ 1. Support for HMR for a great developer experience.
19
+ 1. Supports latest versions of React with hooks.
20
+ 1. [Redux](https://github.com/reactjs/redux) and [React Router](https://github.com/ReactTraining/react-router#readme) integration including server-side-rendering.
21
+ 1. [Internationalization (I18n) and (localization)](https://www.shakacode.com/react-on-rails/docs/guides/i18n/)
22
+ 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/).
23
+ 1. [ReScript (Reason ML) Support](https://github.com/shakacode/reason-react-on-rails-example).
24
+
25
+ See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
26
+ ----
27
+
28
+ ## Prerequisites
29
+
30
+ Ruby on Rails >=5 and rails/webpacker 4.2+.
@@ -1,6 +1,6 @@
1
1
  # React Server Rendering
2
2
 
3
- See also [Client vs. Server Rendering](https://www.shakacode.com/react-on-rails/docs/basics/client-vs-server-rendering).
3
+ See also [Client vs. Server Rendering](https://www.shakacode.com/react-on-rails/docs/guides/client-vs-server-rendering/).
4
4
 
5
5
  ## What is the easiest way to setup a webpack configuration for server-side-rendering?
6
6
  See the example webpack setup here: [github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh](https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh).
@@ -13,7 +13,7 @@ During the Rails rendering of HTML per a browser request, the Rails server will
13
13
 
14
14
  The default JavaScript interpretter is [ExecJS](https://github.com/rails/execjs). If you want to maximize the perfomance of your server rendering, then you want to use React on Rails Pro which uses NodeJS to do the server rendering. See the [docs for React on Rails Pro](https://github.com/shakacode/react_on_rails/wiki).
15
15
 
16
- See [this note](https://www.shakacode.com/react-on-rails/docs/basics/client-vs-server-rendering).
16
+ See [this note](https://www.shakacode.com/react-on-rails/docs/guides/client-vs-server-rendering/).
17
17
 
18
18
  ## How do you do Server Rendering with React on Rails?
19
19
  1. The `react_component` view helper method provides the `prerender:` option to switch on or off server rendering.
@@ -1,5 +1,5 @@
1
1
  # RSpec Configuration
2
- _Click [here for minitest](https://www.shakacode.com/react-on-rails/docs/basics/minitest-configuration)_
2
+ _Click [here for minitest](https://www.shakacode.com/react-on-rails/docs/guides/minitest-configuration/)_
3
3
 
4
4
  # If your webpack configurations correspond to rails/webpacker's default setup
5
5
  If you're able to configure your webpack configuration to be run by having your webpack configuration
@@ -9,7 +9,7 @@ compiled by webpack before running tests and during production deployment:
9
9
  1. **Use rails/webpacker's compile option**: Configure your `config/webpacker.yml` so that `compile: true` is for `test` and `production`
10
10
  environments. Ensure that your `source_path` is correct, or else `rails/webpacker` won't correctly
11
11
  detect changes.
12
- 2. **Use the react_on_rails settings and helpers**. Use the settings in `config/initializers/react_on_rails.rb`. Refer to [docs/configuration](https://www.shakacode.com/react-on-rails/docs/basics/configuration).
12
+ 2. **Use the react_on_rails settings and helpers**. Use the settings in `config/initializers/react_on_rails.rb`. Refer to [docs/configuration](https://www.shakacode.com/react-on-rails/docs/guides/configuration/).
13
13
 
14
14
  ```yml
15
15
  config.build_test_command = "NODE_ENV=test RAILS_ENV=test bin/webpack"
@@ -1,7 +1,5 @@
1
1
  # React on Rails Basic Tutorial
2
2
 
3
- -----
4
-
5
3
  **November 11, 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`. This file will be update shortly. Most of it is still relevant.
6
4
 
7
5
  -----
@@ -292,8 +290,8 @@ versus with server rendering:
292
290
 
293
291
  For more details on server rendering, see:
294
292
 
295
- + [Client vs. Server Rendering](https://www.shakacode.com/react-on-rails/docs/basics/client-vs-server-rendering)
296
- + [React Server Rendering](https://www.shakacode.com/react-on-rails/docs/basics/react-server-rendering)
293
+ + [Client vs. Server Rendering](https://www.shakacode.com/react-on-rails/docs/guides/client-vs-server-rendering/)
294
+ + [React Server Rendering](https://www.shakacode.com/react-on-rails/docs/guides/react-server-rendering/)
297
295
 
298
296
  ## Moving from the Rails default `/app/javascript` to the recommended `/client` structure
299
297
 
@@ -25,7 +25,7 @@ If you still need that feature, please file an issue.
25
25
  In order to solve the issues regarding React Hooks compatibility, the number of parameters
26
26
  for functions is used to determine if you have a Render-Function that will get invoked to
27
27
  return a React component, or you are registering a React component defined by a function.
28
- Please see [Render-Functions and the Rails Context](https://www.shakacode.com/react-on-rails/docs/basics/render-functions-and-railscontext) for
28
+ Please see [Render-Functions and the Rails Context](https://www.shakacode.com/react-on-rails/docs/guides/render-functions-and-railscontext/) for
29
29
  more information on what a Render-Function is.
30
30
 
31
31
  ##### Update required for registered functions taking exactly 2 params.
@@ -22,7 +22,7 @@ A key decision in your use React on Rails is whether you go with the rails/webpa
22
22
 
23
23
  ## Option 1: Default Generator Setup: rails/webpacker app/javascript
24
24
 
25
- Typical rails/webpacker apps have a standard directory structure as documented [here](https://github.com/rails/webpacker/blob/5-x-stable/docs/recommended-project-structure.md). If you follow the steps in the the [basic tutorial](https://www.shakacode.com/react-on-rails/docs/basics/tutorial), you will see this pattern in action. In order to customize the Webpack configuration, you need to consult with the [rails/webpacker Webpack configuration](https://www.shakacode.com/react-on-rails/docs/javascript/webpack).
25
+ Typical rails/webpacker apps have a standard directory structure as documented [here](https://github.com/rails/webpacker/blob/5-x-stable/docs/recommended-project-structure.md). If you follow the steps in the the [basic tutorial](https://www.shakacode.com/react-on-rails/docs/guides/tutorial/), you will see this pattern in action. In order to customize the Webpack configuration, you need to consult with the [rails/webpacker Webpack configuration](https://www.shakacode.com/react-on-rails/docs/javascript/webpack/).
26
26
 
27
27
  The *advantage* of using rails/webpacker to configure Webpack is that there is very little code needed to get started and you don't need to understand really anything about Webpack customization.
28
28