Skip to content

Commit 05a718a

Browse files
committed
linting
1 parent 86bab4d commit 05a718a

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

docs/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ Jump straight to what you need
3333

3434
Find guidance for your specific scenario:
3535

36-
| I want to... | Go here |
37-
| ----------------------------------- | -------------------------------------------------------------------------------------- |
38-
| **Add React to existing Rails app** | [Installation Guide](./getting-started/installation-into-an-existing-rails-app.md) |
39-
| **Enable server-side rendering** | [SSR Guide](./core-concepts/react-server-rendering.md) |
36+
| I want to... | Go here |
37+
| ----------------------------------- | ------------------------------------------------------------------------------------- |
38+
| **Add React to existing Rails app** | [Installation Guide](./getting-started/installation-into-an-existing-rails-app.md) |
39+
| **Enable server-side rendering** | [SSR Guide](./core-concepts/react-server-rendering.md) |
4040
| **Set up hot reloading** | [HMR Setup](./building-features/hmr-and-hot-reloading-with-the-webpack-dev-server.md) |
41-
| **Use Redux with Rails** | [Redux Integration](./building-features/react-and-redux.md) |
42-
| **Deploy to production** | [Deployment Guide](./deployment/deployment.md) |
43-
| **Troubleshoot issues** | [Troubleshooting](./deployment/troubleshooting.md) |
41+
| **Use Redux with Rails** | [Redux Integration](./building-features/react-and-redux.md) |
42+
| **Deploy to production** | [Deployment Guide](./deployment/deployment.md) |
43+
| **Troubleshoot issues** | [Troubleshooting](./deployment/troubleshooting.md) |
4444

4545
## 📖 Documentation Categories
4646

docs/getting-started/using-react-on-rails.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ When you install React on Rails, several things happen:
1616
4. **Shakapacker configured** - Webpack integration for Rails (required dependency)
1717

1818
The generator sets up:
19+
1920
- Component directories (typically `app/javascript/bundles/` or with auto-bundling in `app/javascript/src/*/ror_components/`)
2021
- Rails integration (controllers, views, initializer)
2122
- Webpack configuration for building JavaScript bundles
2223
- Development workflow with hot module replacement
2324

2425
**For detailed installation instructions, see:**
26+
2527
- **[Quick Start Guide](./quick-start.md)** - Fastest path (15 minutes)
2628
- **[Installation Guide](./installation-into-an-existing-rails-app.md)** - For existing Rails apps
2729
- **[Complete Tutorial](./tutorial.md)** - Step-by-step with Redux and routing
@@ -39,11 +41,13 @@ Once installed, you render React components in Rails views using the `react_comp
3941
### Basic Options
4042

4143
**Client-side rendering only (default):**
44+
4245
```erb
4346
<%= react_component("HelloWorld", props: { name: "World" }) %>
4447
```
4548

4649
**Server-side rendering for SEO/performance:**
50+
4751
```erb
4852
<%= react_component("HelloWorld", props: { name: "World" }, prerender: true) %>
4953
```
@@ -53,6 +57,7 @@ The component name (`"HelloWorld"`) must match the name you registered in your J
5357
### Configuration
5458

5559
React on Rails is configured in `config/initializers/react_on_rails.rb`:
60+
5661
- Server rendering settings
5762
- Development vs production behavior
5863
- Logging options
@@ -87,19 +92,22 @@ You must configure webpack entry points and manually register each component.
8792
```
8893

8994
With auto-bundling enabled:
95+
9096
1. Place components in designated directories (e.g., `app/javascript/src/*/ror_components/`)
9197
2. React on Rails automatically finds and bundles them
9298
3. No manual webpack configuration needed
9399
4. No manual `ReactOnRails.register()` calls
94100
5. Components are loaded on-demand per page
95101

96102
**Configuration (in `config/initializers/react_on_rails.rb`):**
103+
97104
```ruby
98105
config.components_subdirectory = "ror_components" # Directory name for auto-discovery
99106
config.auto_load_bundle = true # Enable automatic bundle loading
100107
```
101108

102109
**Benefits:**
110+
103111
- Eliminates boilerplate configuration
104112
- Automatic code splitting per component
105113
- Smaller initial bundle sizes
@@ -137,6 +145,7 @@ app/javascript/
137145
### Development Workflow
138146

139147
The generator creates `bin/dev` for starting both:
148+
140149
- Rails server (port 3000)
141150
- Webpack dev server (for hot reloading)
142151

@@ -156,15 +165,11 @@ Sometimes you need more than just a simple React component. **Render-Functions**
156165
```js
157166
const MyApp = (props, railsContext) => {
158167
// Access Rails context
159-
console.log(railsContext.pathname); // Current URL
168+
console.log(railsContext.pathname); // Current URL
160169
console.log(railsContext.i18nLocale); // Current locale
161170

162171
// Return a React component
163-
return () => (
164-
<div>
165-
Hello from {railsContext.pathname}
166-
</div>
167-
);
172+
return () => <div>Hello from {railsContext.pathname}</div>;
168173
};
169174

170175
export default MyApp;
@@ -183,7 +188,9 @@ For advanced server rendering (like React Router), you can return an object:
183188

184189
```js
185190
{
186-
renderedHtml: { componentHtml, redirectLocation, error }
191+
renderedHtml: {
192+
componentHtml, redirectLocation, error;
193+
}
187194
}
188195
```
189196

docs/introduction.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ Step-by-step walkthrough building a full app with Redux, routing, and deployment
7272

7373
Find guidance for your specific scenario:
7474

75-
| I want to... | Go here |
76-
| ----------------------------------- | -------------------------------------------------------------------------------------- |
77-
| **Add React to existing Rails app** | [Installation Guide](./getting-started/installation-into-an-existing-rails-app.md) |
78-
| **Enable server-side rendering** | [SSR Guide](./core-concepts/react-server-rendering.md) |
75+
| I want to... | Go here |
76+
| ----------------------------------- | ------------------------------------------------------------------------------------- |
77+
| **Add React to existing Rails app** | [Installation Guide](./getting-started/installation-into-an-existing-rails-app.md) |
78+
| **Enable server-side rendering** | [SSR Guide](./core-concepts/react-server-rendering.md) |
7979
| **Set up hot reloading** | [HMR Setup](./building-features/hmr-and-hot-reloading-with-the-webpack-dev-server.md) |
80-
| **Use Redux with Rails** | [Redux Integration](./building-features/react-and-redux.md) |
81-
| **Deploy to production** | [Deployment Guide](./deployment/deployment.md) |
82-
| **Troubleshoot issues** | [Troubleshooting](./deployment/troubleshooting.md) |
80+
| **Use Redux with Rails** | [Redux Integration](./building-features/react-and-redux.md) |
81+
| **Deploy to production** | [Deployment Guide](./deployment/deployment.md) |
82+
| **Troubleshoot issues** | [Troubleshooting](./deployment/troubleshooting.md) |
8383

8484
## Core Concepts
8585

0 commit comments

Comments
 (0)