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

react-table: hooks.visibleColumns undefined

const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow, selectedFlatRows, state: { selectedRowIds }} = useTable( { columns: COLUMNS, data: testdata, }, useRowSelect, (hooks) => { hooks.visibleColumns.push((columns) => [ …
0
votes
1 answer

How to test react-rails components in rspec feature tests using Cuprite & Webdrivers

I am updating an older app's Ruby and Rails versions and attempting to get all of the feature tests passing. Most of them were failing due to still relying on capybara-webit. I have replaced that with webdrivers and cuprite and that fixed about half…
Ando
  • 165
  • 1
  • 14
0
votes
1 answer

I want to pass an HTMLDivElement as a React child. Is that impossible?

Context I am building a React app (rails-react) where I have a parent component GameTracker that has some child components; namely, EquipmentPanel and PinnedPanels. I have added a pinned-panels-container div in the parent component where I want to…
Grimhamr
  • 41
  • 6
0
votes
1 answer

Uncaught ReferenceError: require is not defined react-rails

I'm trying to integrate react-rails 2.6.1 within my rails 4.2.11 app. initially started with webpacker but it's giving me troubles with the actual prod deployment, so I removed webpacker and just pack stuff with sprockets 3.7.2. The page is loaded…
Don Giulio
  • 2,946
  • 3
  • 43
  • 82
0
votes
1 answer

Rails is seeing a post request as a get, with a react front end

I have a post request: axios.post("/api/main/products/area_home_products.json" then in routes.rb : namespace :api do namespace :dashboard do ....other routes... end namespace :main do post…
Gotey
  • 449
  • 4
  • 15
  • 41
0
votes
2 answers

React-rails Cannot Find App Component in View

Finally after many steps of troubleshooting rails is rendering our NavBar component, but not the base App component where everything is imported. Wondering what I might need to consider if there's a gem version not working properly like uglifier?…
Ryan Jones
  • 11
  • 2
0
votes
1 answer

Can't run yarn install smoothly, getting sketchy errors instead

This is happening to me after a git rebase. The following error shows up after: running yarn upgrade having a yarn.lock file Also executing yarn install after deleting yarn.lock when trying to add a new package, with yarn add 2 warnings…
Gotey
  • 449
  • 4
  • 15
  • 41
0
votes
2 answers

Unable to Add React to existing Rails app

I've setup a rails app all good, server runs fine etc, now I need to add React to it. I see the command rails webpack:install:react appears to be the way everyone recommends but when I run this I get the following error: rails aborted! Don't know…
SlugLord
  • 143
  • 1
  • 9
0
votes
0 answers

React-Rails: React component not rendering

I am using the react-rails gem, followed all of the instructions in setup, and I cannot get React to load on the webpage. Screenshot from the React web dev tools: Using ruby 2.7.2, Rails 6.1.4. -- I tried it from a clean install and it worked…
Jackson Riso
  • 85
  • 1
  • 6
0
votes
0 answers

How to redirect from rails controller update action after a client (react) update?

So I feel like this should be straightforward. I am using the react-rails gem to use some react in my rails app when needed. In this case, I am rendering a react_component form in the edit view. Once the update is complete (which takes place in…
user15395591
  • 153
  • 1
  • 1
  • 7
0
votes
0 answers

react-rails heroku images/videos not showing

Hello I am trying to deploy my Rails app on heroku and non of my images or videos are showing when I deploy into production gem 'rails', '~> 6.0.3', '>= 6.0.3.4' ... gem 'react-rails' here is a snippet of one of my image files
CJG
  • 457
  • 2
  • 17
0
votes
0 answers

Video won't play react-rails

Hello I am trying to have a video play in my react rails component: import React from "react" import PropTypes from "prop-types" class Video extends React.Component { render () { return (
CJG
  • 457
  • 2
  • 17
0
votes
1 answer

useEffect / useState / setInterval React on Rails components not rendering

I am trying to use useEffect, setInterval and useState in order to cycle through fontawesome icons at a timed interval. I am very new to react and I am not getting any errors my component and all of the components below it are just not rendering. I…
CJG
  • 457
  • 2
  • 17
0
votes
1 answer

Webpacker adding "dist" folders

I'm running Rails 6 w/ React-Rails and using a webpack-dev-server with hot reloading for development. Most of the time everything works fine; when I save changes to my javascript files webpacker recompiles and loads the updates. Twice now while…
aoh
  • 1,090
  • 2
  • 13
  • 25
0
votes
2 answers

onChange function not working in a react component in a erb with react-rails

I am using rails 5.1.7 with the react-rails gem, having a react component in one of my erb views with the react_component() helper I am trying to make an onChange event work, but the function does not respond in any way. I should be able to see the…
Gotey
  • 449
  • 4
  • 15
  • 41