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

React mobx update on API

mobx: 5.03 react: 16.4.1 mobx-react: 5.2.3 rails: 5.0.2 react-rails gem I have a basic mobx setup in react. I am trying to get the rowData observable variable to change in the view after an http request. However, once it is rendered at the default…
GavinBelson
  • 2,514
  • 25
  • 36
2
votes
0 answers

Testing React Component w/ Enzyme Depends on Head/Meta Tag

I am trying to test a component that requires a meta tag in the head of the HTML page. The reason it requires this is because it is a rails application and uses react-rails-form-helpers to render the form with the CSRF token which it takes from the…
Adam Thompson
  • 3,278
  • 3
  • 22
  • 37
2
votes
0 answers

Attach resource path to model in Rails

I’m currently building a Rails app that has some React components mixed in using rails/webpacker. They are being rendered out in views like this: <%= react_component("CampaignTable", campaigns: @plan.campaigns.today, props: {tableTitle: "Upcoming"})…
gosseti
  • 965
  • 16
  • 40
2
votes
1 answer

Using Rails data as the defaultProps in react component

I'm using react-rails (with sprockets rather than webpack, if it turns out to be relevant), trying to make a reusable component for a sprawling rails application. It's basically a navbar, and we have a list of links we usually want to display, but…
Clara B
  • 461
  • 4
  • 14
2
votes
1 answer

Can I call fields from associated model in react components?

Is there a way to get fields from associated model in react components in rails? I have listing model that I am maping through in react component and getting all the fields within each record including the ID of the model that is associated to…
2
votes
1 answer

React Rails: Rendering an html.erb file in React js.jsx

I have a react-rails project (ES5) in which I am trying to render a form from a _form.html.erb file in a React Component.js.jsx ... and I am really lost on how to approach this situation, if it is even possible. There are many forms in my project,…
darkknightsds
  • 530
  • 8
  • 16
2
votes
0 answers

React-Rails instance variable join

So I am starting to integrate my rails application with react, and I am using react-rails gem. It works fine, but I have the following problem: I am creating a component and I want to pass an instance variable as props to this component. But one of…
Gabriel Mesquita
  • 2,271
  • 1
  • 20
  • 30
2
votes
1 answer

Error on calling react-modal in rails 4 app

I'm having trouble using react-modal in my rails 4 app with a react-rails front end. I have already followed the steps in this SO question How to call react-modal from rails-assets.org in react-rails component and in this GitHub issue…
h_tm
  • 137
  • 1
  • 9
2
votes
2 answers

react-rails : component does not re-render after record created

As I am following a tutorial, I am trying to get my GamesBox re-render after a new record(game) has been created through an AJAX call. The record get saved, and I am able to see it by refreshing, however this not seem to be the React way…
twenizaak
  • 151
  • 2
  • 4
2
votes
2 answers

Getting started with React and Rails

I have started a new project in which I would like to use React and Rails. This project is on the small side and will require some basic interactive UI, hence React. As far as I know there are two ways I could get started with this: Using the…
Nicholas Haley
  • 3,558
  • 3
  • 29
  • 50
2
votes
2 answers

Could not find json-1.8.1 in any of the sources

I'm doing a project using react-rails but when I run bundle install I get Could not find json-1.8.1 in any of the sources Specifically, this is the entire error Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current…
Montana
  • 53
  • 1
  • 10
2
votes
1 answer

Mysterious span appearing in HTML for react code

I am using coffeescript with react-rails gem. In the measure.js.coffee, there is no span present in the coffee code, but when the HTML is getting painted a mysterious ghost span is appearing. Below is a screenshot of code and HTML generated by…
Vipin Verma
  • 5,330
  • 11
  • 50
  • 92
2
votes
0 answers

React::ServerRendering::PrerenderError with react prerender: true

I am getting following error when I am using prerender: true. I am using react-rails gems its working fine with prerender: false var Router = window.ReactRouter.Router var Route = window.ReactRouter.Route var Albums = React.createClass({ render:…
Vijay Chouhan
  • 4,613
  • 5
  • 29
  • 35
2
votes
2 answers

React-Rails API Polling

I am new to React, I have gone through the official React tutorials on how to use React as a standalone service and have just gone through this tutorial on using the react-rails gem in a Rails App, which for the most part I have appropriated to be…
Zubatman
  • 1,235
  • 3
  • 17
  • 34
2
votes
2 answers

How to call react-modal from rails-assets.org in react-rails component

I have a rails app that uses react on the front end but I'm having trouble adding other react modules to my components. I am using react-rails for incorporating react into my rails app. I would like to add react-modal to a component. I've used…