Questions tagged [react-rails]

Regarding React.js + Ruby on Rails, especially the `react-rails` gem.

react-rails is a Ruby gem for integrating React.js into a Ruby on Rails application. Topics include transforming JSX, mounting React components into Rails views, and rendering React components on the server. Learn more on Github: https://github.com/reactjs/react-rails.

282 questions
3
votes
0 answers

Devise session not persisting after login redirect on React-Rails app

We have a pretty standard React-Rails app with (prerender = true) (following this tutorial and his accompanying repo). We're currently using the Devise gem to implement users. However, right now after a successful login and the user is redirected to…
MHF
  • 67
  • 7
3
votes
1 answer

How to manage themes for react components

I want to have a stable and scalable way of implementing themes in my react-rails project. Currently the react components have their own CSS files and the styling is managed using CSS-modules ... What would be the best way to have different CSS…
Ani U
  • 31
  • 2
3
votes
1 answer

What difference does the leading underscore make when naming React component files in Rails?

I'm just getting started with React in Rails. When I come across other's Rails apps with React, I find some of them add a leading underscore when naming *.js.* files in /app/assets/javascripts/components/. e.g. Sample React Rails App Component files…
sunquan
  • 322
  • 3
  • 9
3
votes
0 answers

Rails, React, Browserify , react-rails gem - Cannot find module

I am following this great tutorial: setting-up-react-in-ruby-on-rails-part-1 I am getting this error: Error: Cannot find module xxx from xxx test-component.es6.js React = require('react/addons'); let TestTwo =…
Sysrq147
  • 1,359
  • 4
  • 27
  • 49
2
votes
2 answers

How do I import an image in to react Im using rails 7

ERROR] Could not resolve "logo.png" │ import logo from 'logo.png' 08:55:46 js.1 | ╵ import logo from './logo.png' import logo from './images/logo.png' import logo from '../images/logo.png' import logo from './images/logo' I keep…
2
votes
0 answers

Fetch Rails i18n translations to be rendered in React

I have a React/Rails application which I am setting up i18n translations. Using rails-i18n and i18n.js gems. I have en.yml and es.yml files for english and spanish. The translations seem to work well for this application. I am able to get the…
2
votes
1 answer

Getting "Invalid value type" error when trying to execute yarn in my react-rails project

I am getting: error An unexpected error occurred: "Invalid value type 2:0 in /Users/myname/Desktop/work2/reservations_fully_paid/Foggle/yarn.lock". info If you think this is a bug, please open a bug report with the information provided in…
Gotey
  • 449
  • 4
  • 15
  • 41
2
votes
1 answer

Ruby on Rails "support for the experimental syntax 'jsx' isn't currently enabled"

I am building an app with rails-react. One of my views, search_terms/index, utilizes a react component called SearchTermIndex.js as follows: <%= react_component("SearchTermIndex", { currentUser: current_user, admin: User.where(admin:…
2
votes
0 answers

How to debug a ExecJS error in react-rails

I am getting; Encountered error "#
Gotey
  • 449
  • 4
  • 15
  • 41
2
votes
0 answers

Upgarde to react 17 in rails with webpacker 5

I was trying to upgrade react version on my rails 5 project using webpacker 5, I am using gem "react-rails", "2.4.4" and I tried to use the new JSX transform feature in react 17, but was getting some error In my package.json I am using …
suvodipMondal
  • 656
  • 10
  • 27
2
votes
1 answer

No such file or directory @ rb_sysopen when using a component with react-rails gem

I am using rails 5.1.7 with the gem react-rails. I added a react component in a erb view as: <%= react_component("cardlist", { all_cards: @all_cards }, {prerender: true}) %> Which works fine on my local environment, but when deploying the app to…
Gotey
  • 449
  • 4
  • 15
  • 41
2
votes
1 answer

Rails webpacker returning SyntaxError for all JSX expressions

Ok so I have a Rails application that has been upgraded to Rails 6. All of my React code is in a directory app/react which is the source_path in my webpacker.yml file. rails assets:precompile works fine, however when I run ./bin/webpack locally…
user3895395
  • 471
  • 4
  • 16
2
votes
1 answer

React Rails project deployed on Heroku appeared different from on localhost

I have deployed a React-Rails app onto Heroku (https://shirleyow-todolist.herokuapp.com/), but the turnout was drastically different from when I was using localhost to create it. Here are some screenshots to illustrate this: Homepage on…
Shirley Ow
  • 383
  • 2
  • 7
2
votes
1 answer

Using nested folders with react-rails prerender

I'm trying to set up react-rails for my app (https://github.com/reactjs/react-rails). I had no problem getting it to set up initially, but I'm anticipating a lot of different individual components so I want to organize my /javascript/components…
Almaron
  • 4,127
  • 6
  • 26
  • 48
2
votes
2 answers

Rendering a react component in Ruby on Rails partial

Is it possible to render a react component in a rails partial through an AJAX call? Basically for performance reasons, I have to do some condition checks in order to render and initialize a react component in rails view. I cannot require the react…
Pragun
  • 1,123
  • 8
  • 20