react_on_rails | webpacker including server-side rendering | Frontend Framework library
kandi X-RAY | react_on_rails Summary
kandi X-RAY | react_on_rails Summary
React on Rails integrates Rails with (server rendering of) Facebook's React front-end framework. This project is maintained by the software consulting firm ShakaCode. We focus on Ruby on Rails applications with React front-ends, often using TypeScript or ReScript (ReasonML). We also build React Native apps and Gatsby sites. See our recent work for examples of what we do. ShakaCode.com (HiChee.com) is hiring developers that like working on open-source. 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 is serving millions of SSR requests per day React on Rails. Check out React on Rails Pro. For more information, feel free to contact Justin Gordon, justin@shakacode.com, maintainer of React on Rails.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react_on_rails
react_on_rails Key Features
react_on_rails Examples and Code Snippets
Community Discussions
Trending Discussions on react_on_rails
QUESTION
Currently, Rails application is on service.
The environment is following the below.
I'm thinking to introduce React to my app.
But in case of management screen, I want to use Rails.
Because it's already customized a lot and no complaint so far.
I think to introduce React to Rails app is 3way.
- Using Webpacker
- Using Gem(react-rails/react_on_rails)
- Using
create-react-app
From my thinking, 1&2 and 3 have big differences. 1&2 is React renders from Rails View. 3 is React renders independently and Rails is just used for API.
So I have three questions.
- Compare 1&2 and 3, which is faster? Is there big different?
- In case of 3, I think React'host should be 3000, Rails should be 3001. Is it possible to release step by step? Like introducing React only top screen, others are Rails.
- In case of 3, can I use RailsAdmin for management screen?
I have no idea.
Please help me..
ANSWER
Answered 2022-Jan-14 at 08:33I would almost always use the approach number 3, as in using Rails as an API and having admin panel. To achieve this you simply define a different route for all the api endpoints and the admin, don't overthink this. Under the rails port you can put all the API endpoints and a rails admin endpoint. Using Webpacker in rails is still supported but starting with rails 7 it is no longer the default, which means that in case of some problems (which in my experience are frequent with webpacker) you might have a harder time finding some help. Using gems to work with JS frameworks always seems to me like an unnecessary complication, and adding an extra tool to help with a different tool...
Keep both tools to themselves, you can still have both apps in one repository nothing is stoping you from that, but Rails being responsible for the backend and react being the frontend is the most sensible approach IMHO. Nothing stands in a way of using rails app as both the API server and rails admin managment view. It is just a matter of setting up the routes.
QUESTION
Using react-router-dom I need to use one component for many url's with props that change the API call to fetch data. I cannot figure out how to pass these props to the components.
I'm learning react by hacking away, but I've been stuck on this for over 4 hours. I've read every post I can find and visited many websites claiming to have the solution to my problem. The solutions posted here cover almost every post's solution (use render). React router pass props to route component
Here is my relevant code, please let me know what else to add if needed. Note: I followed the setup tutorial for react_on_rails and I've been building upon that codebase.
I've tried bypassing the MediaGridContainer.js redux connecter file and use MediaGrid.jsx directly but that also does not work. My API call works fine if I hardcode scope and class_name in MediaGrid.jsx.
...ANSWER
Answered 2021-Jul-24 at 22:28To pass your props to your component use render prop
, also you should change your routes to start with /movies, otherwise, your components will not work.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react_on_rails
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page