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
0
votes
0 answers

Rails-React: passing a rendered jbuilder template to component props from controller

Right now I have my index action set up like this, and I when the games component is rendered it basically receives games.to_json, I would like to reuse the template I have for GET /games.json which is specified in views/games/index.json.builder I…
Juan Fuentes
  • 1,743
  • 2
  • 20
  • 33
0
votes
0 answers

How to handle redirect in reactJS?

I'm using React as frontend application and Rails API server, if a user tries to hit go to an authenticated resource I send a 302 redirect response from RAILS API, how to handle it and redirect the React Application to /login page. Thanks in…
0
votes
1 answer

How to implement a PureComponent in ES5

A bit of context: Rails Application running react-rails on sprockets (No es6) React version 15.4.1. This means our components are defined like: var ComponentName = React.createClass(... I'm attempting to use a callback to pass state from a child…
Justus Eapen
  • 1,139
  • 10
  • 22
0
votes
1 answer

React-Rails 6 - Unable to import node_modules package

I'm trying to use an npm package in my react-rails project but can't seem to successfully import it. I first ran the following: yarn add @mapbox/mapbox-gl-draw Then, I tried both of the following import styles: import * as MapboxDraw from…
Syntactic Fructose
  • 18,936
  • 23
  • 91
  • 177
0
votes
0 answers

What is the best way to create a react application with rails backend?

I have a rails application and i want to use react for the front end. Could anyone suggest what will be the best way to do that?
Sourav Dey
  • 1,051
  • 1
  • 13
  • 21
0
votes
0 answers

Pass data between components react-rails

There are three components and I want to pass the data from calendar to ItemForm component through Main. Main Component: var Main = createReactClass({ getInitialState() { return { items: [] , } }, componentDidUpdate() { …
Tjax
  • 323
  • 1
  • 5
  • 12
0
votes
1 answer

Ruby on Rails, I try to create a form using the application, but when I get to the show page..everything is empty

I am new to Ruby on Rails and I am having an issue when I am about to submit my form. Everything when well when I was about to create the form(as shown in 1st picture), but as soon as I get to the show path I show nothing of what I input to the form…
Heinrich
  • 73
  • 1
  • 8
0
votes
1 answer

Apollo Client: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)

I am using the React Rails gem to server side render my react app. When I turn prerender off, it works fine. But when I switch prerender on I get the following error: Error: Element type is invalid: expected a string (for built-in components) or a…
Hinesh Patel
  • 1,161
  • 2
  • 7
  • 15
0
votes
0 answers

Deploying Rails React application on Heroku without webpack dev server

I precompiled assets in production mode and deployed to heroku, but css and js doesn't seem to work. But when i configure a webpack dev server in heroku everything seems to work. Do we need an additional server for react to work, or just…
YasirAzgar
  • 1,385
  • 16
  • 15
0
votes
1 answer

When I use React_component, View_Helper provided by Gem called react-rails in Rails5, the contents of div become empty without reloading

I use react with Rails 5 using Gem called React-Rails. However, although the component of react is loaded using ViewHelper called react_component, the contents of the div will be empty when the page is transitioned. However, reloading will create…
user3387068
  • 151
  • 1
  • 2
  • 14
0
votes
1 answer

How to implement remote: true for react (rails)?

I create the form in this way: = form_for Review.new do |f| = react_component "Popups/ReviewPopup", {name: "review-popup"} Inside the Popup/PreviewPopup I have a form field with the desired name. And when click on the submit occurs: const…
evans
  • 549
  • 7
  • 22
0
votes
0 answers

CSS Loader Invalid Options options should NOT have additional properties at validateOptions with react_rails application

I am currently creating a rails application with a react frontend. For that, I am using react_rails and webpacker gems. Now I have added bootstrap following all the steps in the installation guide. Now when I run rails server web packer compilation…
0
votes
2 answers

How to redirect to a ruby on rails controller that renders a react rails page

I have a button on my homepage that redirects to my controller: redirect_to edit_user_path(user, track: "homepage") I can see that the redirect works correctly because if I throw a pry inside the controller it'll freeze. The edit action inside my…
Steez
  • 219
  • 5
  • 17
0
votes
1 answer

What's a proper way to design Ruby on Rails application with React

I'm doing some project using Ruby on Rails with React. I'm using react-rails gem. I have some questions about how to properly design the architecture of Rails and React app. My question is mainly about passing data between Rails and React. I know…
Tomasz
  • 191
  • 2
  • 12
0
votes
0 answers

Accessing microservice from React front end violates the document's Content Security Policy

In my project I have a main app hosted at localhost:3000, and a microservice server hosted at localhost:3001 the main app has a front end with a react component that needs to access data from the microservice. So I have my component as…