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
33
votes
8 answers

Error with basic React Example: Uncaught TypeError: undefined is not a function

I'm trying to get react connected into my app. Its a rails app using rails-react (though I don't think that's part of the problem). I'm currently using a very simple 1 component setup: // react_admin.js.jsx /** @jsx React.DOM */ var CommentBox =…
Laurie Young
  • 136,234
  • 13
  • 47
  • 54
16
votes
3 answers

How to use npm packages in rails?

I'm trying to use the Ace editor in my Ruby on Rails app, with majority of the view composed as React components. I'm using the react-rails gem and I'm not using flux at all. I found this react-ace package, but I have to use npm to install it. I've…
Novice
  • 575
  • 2
  • 7
  • 16
10
votes
3 answers

ReactJS form validation when state is not immediately updated

I am trying to create client side validation with ReactJS on my registration form. I am using http://validatejs.org/ library for validations along with https://github.com/jhudson8/react-semantic-ui components for rendering semantic-ui React…
Simon Polak
  • 1,959
  • 1
  • 13
  • 21
9
votes
1 answer

React on Rails integration

I'm looking to implement ReactJS as the view of my Rails application with the gem react-rails. So far, I've only used the standard .erb to render my views in my RoR application and I am wondering some questions about how to do it with React. For…
ZazOufUmI
  • 3,212
  • 6
  • 37
  • 67
8
votes
4 answers

How to change the height of textarea with content?

I am trying to change the height of the textarea as per the content height. I see that the event handler doesn't change the height since it is getting overwritten by the bootstrap style. Please help! class PostForm extends React.Component { …
Santhosh
  • 130
  • 1
  • 2
  • 11
8
votes
2 answers

TypeError: Cannot read property 'userAgent' of undefined

I am trying to integrate react-slick slider into my ReactJS application. Its working as expected when I integrate it into a new demo app, but if I integrate it into my own application it throws an error. I am using rails as backend. When I try to…
Anish
  • 558
  • 3
  • 10
  • 33
8
votes
2 answers

Get Selected option attribute in React

I want to get attribute from my select option list. In meanwhile my code is like below : var Billing = React.createClass({ getInitialState() { return { associations: [], value: '', associationsList: '1' }; }, …
Aizuddin Badry
  • 454
  • 3
  • 9
  • 22
8
votes
1 answer

Using 'material-ui' with react-rails gem?

I would like to use the material-ui component library in my Rails 4 app. I am currently using the react-rails gem to add .jsx compilation to the asset pipeline. I have added material-ui via rails-assets in the gemfile like so: source…
Cu1ture
  • 1,273
  • 1
  • 14
  • 29
8
votes
2 answers

Adding styling to rails react component wrapping div

I'm using react_component in my Rails project. This inserts a wrapping div for the react.js component, e.g.
Daniel May
  • 2,192
  • 5
  • 25
  • 43
7
votes
1 answer

Warning: input is a void element tag and must not have `children` or use `props.dangerouslySetInnerHTML`. Check the render method of null

I am trying to render the errors in the form if the ajax call to the form URL fails. Below is my Admin component: #app/assets/javascripts/components/admin.js.coffee @Admin = React.createClass # propTypes: -> # emailVal:…
Vipin Verma
  • 5,330
  • 11
  • 50
  • 92
7
votes
2 answers

How to call internal API from Rails view (for ReactJS prerender purpose)?

I already have Rails API controller which return JSON response. It is used by front-end Javascript (as well as mobile app) to render values. Now, I wish to prerender those values using ReactJS: #app/controllers/api/v1/products_controller.rb module…
Pahlevi Fikri Auliya
  • 4,157
  • 8
  • 35
  • 71
6
votes
1 answer

React Rails with Webpacker not hot reloading

I've added react-rails to an existing project that we're slowly migrating over to react. Current webpacker.yml default: &default source_path: app/javascript source_entry_path: packs public_output_path: packs cache_path:…
6
votes
3 answers

How use react-rails with webpacker?

I created example project react-rails with webpacker. but show error "Uncaught ReferenceError: Person is not defined". help me How use react-rails with webpacker? The processing I performed is as follows. Rails version $ rails -v Rails 5.0.2 Gem…
6
votes
1 answer

D3 pie chart: Uncaught Type Error - Cannot read property 'pie' of undefined

I am attempting to create a d3 pie chart based off of this resource. However, I get the following error: Uncaught Type Error - Cannot read property 'pie' of undefined My code: class PieChart extends React.Component { constructor() { …
mGarsteck
  • 671
  • 2
  • 6
  • 16
6
votes
1 answer

(Jade or Slim)-like syntax for React?

I've gotten used to using slim and jade and I recently moved to writing applications on the front end with React and find that now I'm writing bloated HTML again inside my components. I'm currently using Ruby on Rails and .jsx files with babel, etc…
user4855927
1
2 3
18 19