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

Integrated React component from Rails-assets.org in Rails Application

i tried to integrated react component from rails-assets.org in my rails application. Currently, i used react-rails gems to write react view in my application. I want to use other react component such as react-router, react-select, etc. I found the…
Aizuddin Badry
  • 454
  • 3
  • 9
  • 22
0
votes
1 answer

ReactJS: how to use setState to swtich active item

Found mistake by myself, see my answer below But I would appreciate, if smb explain me how this magic with handling events work. How changeActive function knows what index variable is? I have list of statements, first of them is active by default. I…
nuT707
  • 1,543
  • 4
  • 17
  • 27
0
votes
1 answer

react router server side rendering with rails

I am using React Js with rails 5.0 Important Gems are gem 'rails', '~> 5.0.2' gem 'react-rails' gem 'react-router-rails' gem 'slim-rails' my layout and page template is in slim and I am using coffee everywhere. I am facing lots of problem when I…
0
votes
1 answer

React-rails store POST request response

currently i used Ruby on Rails as my backend to serve API to my apps. And my front end i use React-rails gem (React.js) to get/post data and generate output. Both API and apps are on different server. My problem here is, i cannot store response from…
Aizuddin Badry
  • 454
  • 3
  • 9
  • 22
0
votes
2 answers

React-Rails: .js.jsx file crashes Rails application

I'm new to Rails and ReactJS. I've been having a lot of issues rendering a simple "Hello World" component with the react-rails gem on Rails 5.0.2, running on Windows 7. If I include a .js.jsx file in the components folder, my app crashes.…
ariyo
  • 3
  • 3
0
votes
1 answer

Syntax error in basic react-rails component

Rails can't render a basic react component I've just started building out due to a supposed syntax error in one of my components. Thus far I haven't been able to figure out why this syntax is incorrect. Here is the error:…
0
votes
1 answer

Rails CORS issue with Ajax API endpoint Request

I seem to be running into some issues making a GET request to an API endpoint. I know rails has some security going on behind the scenes. I'm using React-Rails and in my componentDidMount to make an ajax call to an API endpoint. I am passing in a…
John
  • 3
  • 4
0
votes
0 answers

Not calling react function outside of react scope

I have a react class like below: var AllMeals = React.createClass({ .... concatMeal: function(new_meal) { newState = this.state.meals.concat(new_meal); this.setState({ meals: newState }); }, .... }); module.exports =…
Bhushan Lodha
  • 6,824
  • 7
  • 62
  • 100
0
votes
1 answer

React.js, handling onMouseOver event

being a noob in React I'm facing a problem: the component returns a simple nested table, so each cell of the 'big-table-id' contains another small table 'small-table-id'. Thing is that every time the mouseover event occurs I'm always getting the…
0
votes
0 answers

How to get rid of class component div in react

I wanted to make dropdown menu and i did actually made it, but now i have one annoying problem. I got the blank div of reactJS component when my menu is not here. normal menu blank div in the back So, here is the code behind this @Users =…
sheff3rd
  • 63
  • 7
0
votes
0 answers

A onClick attribute has error

Something wrong error occured! I use react js and react-rails gem. I have a problem. When I add a onClick attribute to JSX onClick={() => this.handleClick()}, but it does not work. If I removed a onClick attribute, It works. Why?? export default…
minmin
  • 53
  • 1
  • 13
0
votes
1 answer

React-Rails - problems getting started

I'm trying to figure out how to use react-rails with my Rails 5 gem. At the moment, I'm trying to follow the tutorial in this post.…
Mel
  • 2,481
  • 26
  • 113
  • 273
0
votes
2 answers

ActiveModelSerializer not kicking in

I want to serialize the newly created resource in this action : def create @comment = @commentable.comments.build(comment_params) @comment.user = current_user respond_to do |format| if @comment.save format.json { render…
0
votes
1 answer

React HandleDelete TypeError undefined

I have React component called Websites to handle state class Websites extends React.Component { constructor(props) { super(props); this.handleWebsiteDelete = this.handleWebsiteDelete.bind(this); this.state = { websites:…
Petr
  • 1,853
  • 2
  • 25
  • 49
0
votes
1 answer

How to add or delete objects from React - Rails?

I have a Rails app with react-rails gem. This is my controller: class WebsitesController < ApplicationController def index @websites = Website.all end end This is my view: <%= react_component('WebsiteList', websites: @websites) %> This is…
Petr
  • 1,853
  • 2
  • 25
  • 49