Awesome
<p align="center"> <a href="https://shakacode.com/"><img src="https://user-images.githubusercontent.com/10421828/79436256-517d0500-7fd9-11ea-9300-dfbc7c293f26.png"></a> <a href="https://forum.shakacode.com/"><img src="https://user-images.githubusercontent.com/10421828/79436266-53df5f00-7fd9-11ea-94b3-b985e1b05bdc.png"></a> <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> <a href="https://github.com/sponsors/shakacode"><img src="https://user-images.githubusercontent.com/10421828/79466109-cdd90d80-8004-11ea-88e5-25f9a9ddcf44.png"></a> </p>News
- React on Rails Pro supports the latest features of React 18, including React Server Components and streaming. Contact Justin Gordon for more information.
- ShakaCode now maintains the official successor to
rails/webpacker
,shakapacker
. - Project is updated to support Rails 7 and Shakapacker v6+!
These are the docs for React on Rails 13. To see the older docs: v12 and v11.
About
React on Rails integrates Rails with (server rendering of) React.
This project is maintained by ShakaCode.
ShakaCode Upgrade Support
ShakaCode focuses on helping Ruby on Rails teams better use React and Webpack. We can upgrade your project and improve your development and customer experiences, allowing you to focus on building new features or fixing bugs instead.
For an overview of working with us, see our Client Engagement Model article and how we bill for time.
We also specialize in helping development teams lower infrastructure and CI costs. Check out our project Control Plane Flow, which can allow you to get the ease of Heroku with the power of Kubernetes and big cost savings.
If you think ShakaCode can help your project, click here to book a call with Justin Gordon, the creator of React on Rails.
React on Rails Pro
Are you interested in optimizing your webpack setup for React on Rails, including code splitting with react-router and loadable-components with server-side rendering for SEO and hot-reloading for developers? We did this for Popmenu, lowering Heroku costs 20-25% while getting a 73% decrease in average response times. Several years later, Popmenu serves tens of millions of SSR requests daily with React on Rails Pro.
If you're interested, read more about React on Rails Pro and book a call.
Documentation
See the documentation at shakacode.com/react-on-rails/docs.
Project Objective
To provide a high-performance framework for integrating Ruby on Rails with React, especially regarding React Server-Side Rendering for better SEO and improved performance.
Features and Why React on Rails?
Given that shakacode/shakapacker
gem already provides basic React integration, why would you use "React on Rails"?
- Automatic configuration of what bundles are added to the page based on what React components are on the page. This results in faster browser loading time via smaller bundle sizes.
- Keep up with the latest changes in different versions of React. React 18 is supported.
- 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. Tight integration with shakapacker (or its predecessor rails/webpacker).
- Server-Side Rendering (SSR), often used for SEO crawler indexing and UX performance.
- Automated optimized entry-point creation and bundle inclusion when placing a component on a page. With this feature, you no longer need to configure
javascript_pack_tags
andstylesheet_pack_tags
on your layouts based on what’s shown. “It just works!” - Redux and React Router integration with server-side-rendering.
- Internationalization (I18n) and (localization)
- A supportive community. This web search shows how live public sites are using React on Rails.
- ReScript Support.
See Rails/Webpacker React Integration Options for comparisons to other gems.
Online demo
- See the react-webpack-rails-tutorial for an example of a live implementation and code.
- A deployed version of the project
spec/dummy
, which demonstrates several uses ofreact_on_rails
, will soon be available on Control Plane through this link
ShakaCode Forum Premium Content
Requires creating a free account.
- How to use different versions of a file for client and server rendering
- How to conditionally render server side based on the device type
Prerequisites
Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 3.0.0
Support
- Subscribe for announcements of new releases of React on Rails and of our latest blog articles and tutorials.
- Discussions: Post your questions regarding React on Rails
- forum.shakacode.com: Other discussions
- @railsonmaui on Twitter
- See NEWS.md for more notes over time.
- See Projects using and KUDOS for React on Rails. Please submit yours! Please edit either page or email us and we'll add your info. We also love stars as it helps us attract new users and contributors.
Contributing
Bug reports and pull requests are welcome. To get started, see Contributing and the list of help wanted issues.
Work with Us
ShakaCode is hiring passionate software engineers to work on our projects, including HiChee!
License
The gem is available as open source under the terms of the MIT License.
Supporters
The following companies support our open-source projects, and ShakaCode uses their products!
<br /> <br /> <a href="https://www.jetbrains.com"> <img src="https://user-images.githubusercontent.com/4244251/184881139-42e4076b-024b-4b30-8c60-c3cd0e758c0a.png" alt="JetBrains" height="120px"> </a> <a href="https://scoutapp.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/4244251/184881147-0d077438-3978-40da-ace9-4f650d2efe2e.png"> <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png"> <img alt="ScoutAPM" src="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png" height="120px"> </picture> </a> <a href="https://shakacode.controlplane.com"> <picture> <img alt="Control Plane" src="https://github.com/shakacode/.github/assets/20628911/90babd87-62c4-4de3-baa4-3d78ef4bec25" height="120px"> </picture> </a> <br /> <a href="https://www.browserstack.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/4244251/184881122-407dcc29-df78-4b20-a9ad-f597b56f6cdb.png"> <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/4244251/184881129-e1edf4b7-3ae1-4ea8-9e6d-3595cf01609e.png"> <img alt="BrowserStack" src="https://user-images.githubusercontent.com/4244251/184881129-e1edf4b7-3ae1-4ea8-9e6d-3595cf01609e.png" height="55px"> </picture> </a> <a href="https://railsautoscale.com"> <img src="https://user-images.githubusercontent.com/4244251/184881144-95c2c25c-9879-4069-864d-4e67d6ed39d2.png" alt="Rails Autoscale" height="55px"> </a> <a href="https://www.honeybadger.io"> <img src="https://user-images.githubusercontent.com/4244251/184881133-79ee9c3c-8165-4852-958e-31687b9536f4.png" alt="Honeybadger" height="55px"> </a> <a href="https://reviewable.io"> <img src="https://user-images.githubusercontent.com/20628911/230848305-c94510a4-82d7-468f-bf9f-eeb81d3f2ce0.png" alt="Reviewable" height="55px"> </a>