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

Using react_on_rails how can I remount components similar to ReactRailsUJS.mountComponents

In a react rails project I have converted over from react-rails gem to react_on_rails. Some of the components which are shown in an infinite scroll are re-mounted when they scroll in with ReactRailsUJS.mountComponents. How can I remount the…
svnm
  • 22,878
  • 21
  • 90
  • 105
0
votes
0 answers

React component intermitently working in chrome, debug for stability

This code has been working fine, but now it's working intermittently in chrome. Does anyone know what might be causing this. If so what can I do to increase stability in chrome This function opens a pop up modal with the project form react…
0
votes
1 answer

Rails mailer: generating an email without a user model

I am creating a basic app using react-rails. There are no models involved, but I do have a need to generate emails through a simple form that looks like this: Since I am using React, I need to generate an AJAX Post request and point it towards my…
Nicholas Haley
  • 3,558
  • 3
  • 29
  • 50
0
votes
0 answers

getting user input from a form in backend (rails 4) that uses ajax 'get' call when search button is pressed

So, I have a React-Component (search_alerts.es6.jsx) that looks like this class SearchAlerts extends React.Component { constructor(props) { super(props); console.log(this.props); this.state = { alertsArray: this.props.alerts, zipCode: null, …
0
votes
0 answers

React Objects are not valid as a React child, wrap the object using createFragment(object) from the React add-ons

I am trying to render a few properties to the element on the basis of a condition in react as follows: dom.span className: "btn pull-right btn-primary#{if @state.enableCartButton then '' else ' disabled'}" if @state.enableCartButton onClick:…
Vipin Verma
  • 5,330
  • 11
  • 50
  • 92
0
votes
1 answer

why does createElement prevent the DOM from loading in react-rails?

I'm going through this tutorial, and was fine until I changed the Records component and added React.createElement RecordForm, handleNewRecord: @addRecord between two DOM renderings. Seems to interfere and prevent the DOM from rendering at…
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
0
votes
0 answers

react-rails error: invariant violation

I'm using the react-rails gem, and everything works fine until I press the back button of the browser and go to the previous page. I get the error below. Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. This…
Novice
  • 575
  • 2
  • 7
  • 16
0
votes
1 answer

Add Item to Basket Filter vs Splice ReactJS Javascript

I am an app where I a user can add a productItem to a Basket. At the moment if the user removes an item from the basket I am using .filter to remove the basketItem object from my basketItems array. I then setState to this array with the filtered…
Tom Pinchen
  • 2,467
  • 7
  • 33
  • 53
0
votes
2 answers

react json Objects are not valid as a React child

I am using the React-Rails gem and accessing a json object items from a Rails controller. Rails controller: class ItemsController < ApplicationController def index @items = Item.all render json: @items end end My React App component…
0
votes
0 answers

How do I import and use a React Component using Webpack and React Rails?

I am trying to use a component via NPM called React-TimeAgo. I have managed to install it via NPM and have Webpack integrated with Rails to generate a webpack bundle our of my node_modules. This is all working fine when I import a Javascript…
BarrieH
  • 373
  • 3
  • 11
0
votes
0 answers

Any latest gem of react-router for rails4

I am using rails4 with react-rails gem and there is a gem for react-router is https://github.com/mariopeixoto/react-router-rails but this is using too old version of react-router (0.13) and currently react-router-2 has been launched. So is there any…
0
votes
1 answer

ReactJS + Rails: HABTM is not in attributes and can therefore not be saved

I am part of building a ReactJS (react-on-rails) + Rails application. I am no ReactJS developer myself (yet), but was taken into the project after ReactJS chosen. My issue regards parameters being sent from React to Rails via create and edit post…
sstubben
  • 1
  • 3
0
votes
2 answers

Error Installing react-rails with Rails 5 beta.3

Running a newly installed Rails 5 beta 3 with Ruby 2.2.3. Added react-rails 1.6.0 in the gem file then bundle install. Installed then rails s. Then…
Sylar
  • 11,422
  • 25
  • 93
  • 166
0
votes
0 answers

Uncaught Invariant Violation: ReactCompositeComponent.render(): A valid ReactComponent must be returned

Inside the render method of react, I am trying to render some children on the basis of state variable. Quoted below is the piece of code for the same: render: -> if @state.edit @adminForm() else @adminRow() if…
Vipin Verma
  • 5,330
  • 11
  • 50
  • 92
0
votes
1 answer

Coffeescript: Add a conditional classname governed by a boolean

I am trying to add a class name to an element in react using this: className: "btn btn-primary #{!@valid() ? 'disabled' : ''}" However this is leading to class="btn btn-primary true" This coffee code is compiled to the incorrect JS as…
Vipin Verma
  • 5,330
  • 11
  • 50
  • 92