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

react-rails asset pipeline image path

I'm using the react-rails gem, and I'm having trouble figuring out how to load images from the asset pipeline. I handle this currently by using the .js.jsx.erb extension, but as far as I know this is unconventional. (am I correct?) Sometimes I just…
Novice
  • 575
  • 2
  • 7
  • 16
3
votes
1 answer

React Rails "identifier 'Set' undefined"

I am trying to do server side rendering with rails using webpacker & react-rails. I don't have any problem with client-side rendering but I got the following exception with server-side rendering. ExecJS::ProgramError in Static#index identifier…
aravvn
  • 774
  • 8
  • 8
3
votes
1 answer

Render react component from other react component with rails layout

I am trying to render other component when successfully submit form. Form has different rails layout and after form submit it redirect with different layout. Render component using react-router and redirect object but how can I render it with…
3
votes
0 answers

bad interpreter: No such file or directory for 'bundle install '

I am learning React on Rails. But when I added react-rails gem to gemfile to my Rails app and entered command: bundle install, I am getting following error. /usr/local/Cellar/rbenv/1.1.1/libexec/rbenv-exec: /usr/local/bin/bundle:…
Ishan Patel
  • 5,571
  • 12
  • 47
  • 68
3
votes
1 answer

Including React (react-rails) into a Rails Engine

EDIT: Answered my own question in detail below, so editing this retro-actively to simplify the question How do I include ReactJS into my Rails Engine? If I add the react-rails gem directly, I get the error React::ServerRendering::PrerenderError in…
user2490003
  • 10,706
  • 17
  • 79
  • 155
3
votes
1 answer

React Rails Component is not defined

I'm trying to get the react-rails gem (version 2.1) working in my Rails 4.2.4 app. I've gone through the setup steps in the Readme and I'm using webpacker for the js preprocessing. I have a component inside of app/javascript/components/label.js that…
purpletonic
  • 1,858
  • 2
  • 18
  • 29
3
votes
0 answers

React rails component render error

I have a Login.js.jsx file with Login component as follows: class Login extends React.Component { render() { return ( ); } } I am rendering the components as follows in html.haml file =…
Poojaa Karaande
  • 153
  • 2
  • 10
3
votes
2 answers

how do you use react-rails react_component with webpacker gem rails 5.1?

Newbie here, I've recently implemented the webpacker gem in my react-rails project. Being new to webpack and react, this gem makes a lot of sense to me coming from a rails background. i'm wondering if it were possible to use the react-rails gem in…
user1337902
  • 236
  • 3
  • 11
3
votes
1 answer

How to build a view object in Rails for JavaScript use

What I'm trying to achieve is to use a decorator (maybe Draper) to build an object before passing it to my React code (using the React Rails gem). I can easily decorate an object and use the methods in a view, but that is not possible if I pass an…
3
votes
1 answer

How to tell google maps API loading script to look for callback inside the React componet?

In my rails app i use react.js(react-rails gem) to build the client side of my application. I want to use google maps API in order to implement some geolocation feature. class HomePage extends React.Component { constructor(props) { …
3
votes
0 answers

Preloading options for select with reactJS in Rails

I'm trying to do a select by dynamically loading options using React. my form component: ... React.DOM.select className: 'form-control' name: 'user' React.createElement UserOptions user options component: @UserOptions = React.createClass …
Kkulikovskis
  • 2,028
  • 16
  • 28
3
votes
1 answer

React-Rails: Use components with translations I18n

I have added to my project react-rails gem and I want to use for translated components. I cannot put in the precompiled assets erb templates, but still I am trying to create components, make them available in all the project and then use them in…
mabe02
  • 2,676
  • 2
  • 20
  • 35
3
votes
2 answers

how to avoid key/id problems in reactjs and make props pass from parent to child?

I keep hitting a wall when trying to get the parent data passed down to the child component. My view: <%= react_component 'Items', { data: @items } %> My Items component makes an ajax call, sets state, and renders Item. Leaving key={this.props.id}…
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
3
votes
2 answers

In React-Rails app, passing instance variables from controller to component (and back)

I am creating a React-Rails app, using ES6, and I am having difficulty passing data from the controller to the component (and back). My app includes a record form that pushes the newly created record to the records component. The code within my…
Adam White
  • 1,096
  • 3
  • 14
  • 28
3
votes
2 answers

Communication between React.js and Rails Model

What i want to do ? I wan't to show on my rails view files data with react.js component from my rails models. What i have ? I have installed these gems rails-admin react-rails What i did ? I created a new rails project. I installed…
Cihan Zengin
  • 103
  • 2
  • 12
1 2
3
18 19