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

How to call another component from onClick function in ReactJS

I am learning Reactjs. I have implemented one sample react app with rails. I have search a lots to find the solution but I didn't find any. I wanted to call another component from onClick function. But nothing happen. Is that possible what I try to…
Hetal Khunti
  • 787
  • 1
  • 9
  • 23
5
votes
1 answer

Best way to import single css files in a rails 6 views using webpack

So i already imported the application.scss with the tags <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> and it works however i…
5
votes
2 answers

Rails-React not working with ES6

I'm using the react-rails gem and I'm trying to write a few components in ES6 that look like this. My link_list.js.jsx file import Component from 'react'; import Links from 'link'; class LinkList extends React.component{ constructor(props){ …
Dillon Cortez
  • 186
  • 1
  • 3
  • 17
5
votes
2 answers

React, Ruby on Rails: jsx vs html.erb

I'm using the react-rails gem to integrate react with rails, and I'm conflicted on how I should organize my code. Is it preferable that I have my core html in the html.erb files or in the jsx files? Currently, I basically made everything a…
Novice
  • 575
  • 2
  • 7
  • 16
4
votes
9 answers

Ruby on Rails, No template for interactive request

enter image description here I previously run the rails generate controller Welcome index command on terminal and just directly run the server, but this error message keep occuring: No template for interactive request WelcomeController#index is…
Heinrich
  • 73
  • 1
  • 8
4
votes
1 answer

Uncaught ReferenceError: process is not defined - React-Rails

Components aren't rendering because of the Uncaught ReferenceError error. The error is thrown in one of the React API files (see the code in question below). I'm using the react-rails gem and am trying to render a blank component called 'Test'. The…
iThompkins
  • 155
  • 1
  • 12
4
votes
2 answers

React component not rendering when using react-rails gem

I followed the 'Getting started with webpacker' in react-rails but on running the rails server I dont see the hello world component there. app/javascript/components/HelloWorld.js import React from "react" import PropTypes from "prop-types" class…
Anto Joy
  • 141
  • 3
  • 12
4
votes
1 answer

How to fix Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object

I am trying to run ReactRails app and trying to run a very simple react-select component. However, in the same file if I print just a simple h2 element it works but