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
2
votes
1 answer

Render reactjs component not work

I created a reactjs component by using react-rails gem: @SettingWidget = React.createClass render: -> React.DOM.div React.DOM.span style: color: 'red' 'Hello' React.DOM.span style: color:…
user5804377
2
votes
0 answers

React-rails Animations with Coffeescript

I've been searching for a solution to use ReactJS animations in a RoR app using Coffeescript. I've tried this (assets/javascript/components/sidebar/teams_form.js.jsx.coffee): ReactCSSTransitionGroup = React.addons.CSSTransitionGroup @TeamForm =…
nicolasthy
  • 31
  • 3
2
votes
0 answers

React is not defined except for chrome browser

I'm using react-rails for my rails 4 app. The only way to use react modules was by this method. All works great, no problems. All along I was using chrome version 47.0.2526.106 (64-bit). Using any another browser, I get React is not…
Sylar
  • 11,422
  • 25
  • 93
  • 166
2
votes
2 answers

JSX can't parse partial HTML tag

I'm using react-rails and I need to be able to pass just a start HTML tag (ie:
) and just an end tag into an array (ie:
) in my JSX file. When I try doing either or I get a ExecJS::RuntimeError that says SyntaxError: unknown: Unexpected…
Dan Barbarito
  • 470
  • 4
  • 11
2
votes
1 answer

Remove render blocking javascript in rails with react-rails gem

I have a Ruby on Rails app. For my views i am using react-rails gem. I want to improve pagespeed through Google PageSpeed. My main problem is Remove Render-Blocking JavaScript so i added async: true to my javascript_include_tag helper method. Then…
Panczo
  • 424
  • 5
  • 20
2
votes
1 answer

React component is being rendered, then disappears

Sorry in advance if this question if difficult to understand - not really sure how to ask it. Basically, I have two React components in my rails view that take props of a 'metric' and an 'id'.
<%= react_component…
Jay Deuskar
  • 63
  • 1
  • 4
2
votes
2 answers

React Rails component: manually triggering a re-render

In Rails, I've got a set of Bootstrap tabs on a page with a React component on each one, ie:
... <%= react_component('PeopleWidget', person_id: @person.id) %> ...
Daniel May
  • 2,192
  • 5
  • 25
  • 43
2
votes
1 answer

Reactjs-rails troubles with pre-rendering

I use react-rails gem and met specific trouble: prerendering doesn't work. I've wrote the code, but send an exception to me: Encountered error "ReferenceError: Terminal is not defined" when prerendering Terminal with {} Here is the sources of my…
Alex Antonov
  • 14,134
  • 7
  • 65
  • 142
1
vote
1 answer

Uncaught Error: Cannot find module '@hotwired/turbo-rails'

I am using the Shakapacker https://github.com/reactjs/react-rails and I have come across this error despite following all the steps in the Get started with shakapacker section I am not sure why this is happening any help is…
CoolGuy
  • 99
  • 7
1
vote
0 answers

Uncaught ReferenceError: exports is not defined react-rails

I need to add react-rails to my rails 4 app, but it's giving me hard time to figure out. my project uses sprockets for assets:precompilation, this is my component: import React from "react" class Sidebar extends React.Component { render() { …
Don Giulio
  • 2,946
  • 3
  • 43
  • 82
1
vote
0 answers

Prerendering mui (material-ui) components in react-rails

I have been unable to get mui components to work under server-side rendering with react-rails, I have a full issue writeup here. https://github.com/reactjs/react-rails/issues/1152 Are there any ways to actually get mui to work under server-side…
Sam S.
  • 113
  • 1
  • 7
1
vote
1 answer

React::ServerRendering::PrerenderError in Search#show

I git this error React::ServerRendering::PrerenderError in Search#show from this scrip <%= react_component('TagList', { tags: @tags }, { prerender: true }) %> The errors are as below Encountered error "#
Romeo
  • 329
  • 4
  • 17
1
vote
1 answer

HRM is not working on Ruby on Rails with Webpacker and Docker

I have a container in docker with Ruby on Rails 6, Webpacker and react-rails, when I reload the page it lates more than 20 seconds to compile so I want to add hot reload to my project but it is just not working. The webpack-dev-server es running…
1
vote
1 answer

Share user object between several react_components

What is the best way to share a user object between multiple react_component other than hanging it off of window? For example - <%= react_component("HelloWorld1", { user: @user }) %> <%= react_component("HelloWorld2", { user: @user }) %>
Josh Unger
  • 6,717
  • 6
  • 33
  • 55
1
vote
1 answer

Is it a good practice adding the CSRF token in redux store?

Is it a good practice to store a CSRF token in redux? I was passing it with props before (to add it to Axios headers). I have a rails back end and I am using the gem react-rails, my components are server rendered, so I did not come up with any other…
Gotey
  • 449
  • 4
  • 15
  • 41