Questions tagged [react-on-rails]
112 questions
3
votes
0 answers
window is not defined in server side render window.webpackJsonp
I'm attempting to upgrade a Rails/Webpacker/ReactOnRails application to webpack 4. I have included a call to environment.splitChunks. That is placing this code:
window.webpackJsonp=window.webpackJsonp||[]).push([[11],.......
in my bundle. Since…

Brandon
- 1,735
- 2
- 22
- 37
3
votes
1 answer
How do you hydrate a store using react_on_rails' Redux API?
Currently, I'm working with this setup (simplified for readability):
react_on_rails 11.1.4
Layout Controller (index method):
redux_store('appStore', props: { foo: 'bar' })
Layout:
<%= redux_store_hydration_data %> (before close of body…

robbymarston
- 344
- 3
- 16
3
votes
0 answers
Unable to locate global object error message when using ssr apollo client
I am getting the following error when using react on rails to server side render apollo with react router v4: Error: unable to locate global object. I tried to implement the following but it didnt work:
ApolloClientServer.js
import { ApolloClient }…

Hinesh Patel
- 1,161
- 2
- 7
- 15
3
votes
0 answers
React On Rails SSR "TypeError: Cannot read property 'prototype' of undefined"
I am using "react-on-rails" gem for react and rails but i tried to SSR(server side rendering) prerender: true in rails view file. It's give me error "TypeError: Cannot read property 'prototype' of undefined".
react_on_rails = 10.0.2
webpacker =…

Krishna Vyas
- 285
- 2
- 8
3
votes
1 answer
Loading fonts and images with webpacker
I'm trying to simply load assets (fonts/images) into a Rails project using Webpacker. It's proven to be hilariously more difficult than it should be.
I'm using React on Rails 11.0.4, Rails 5.1.6, and Webpacker 3.5.3.
I've tried creating custom…

Doug
- 1,517
- 3
- 18
- 40
3
votes
1 answer
Accessing NODE_ENV environment variable in React on Rails
I've got a React on Rails application that hits an API. I want to configure the API endpoint to localhost for development and to my deployed app's URL for production.
client/package.json
"scripts": {
"build:production": "NODE_ENV=production…

Matthew Hinea
- 1,872
- 19
- 31
3
votes
1 answer
Google Places Autocomplete React Component
I'm learning react and trying to create a Google places autocomplete component, inside a rails app the using react on rails gem. Here's what I have so far, need some help finishing it off.
I think I'm having an issue getting the Google javascript…

Michael Lee
- 458
- 1
- 8
- 18
3
votes
1 answer
Capistrano deploy fails with react_on_rails when NPM is installed via NVM
The failing command cd client && npm run build:production comes from https://github.com/shakacode/react_on_rails/blob/master/lib/tasks/assets.rake
When using capistrano-npm and capistrano-nvm it creates /tmp/my_app_name/nvm-exec.sh with these…

Dmitry Polyakovsky
- 1,535
- 11
- 31
2
votes
2 answers
React: Rendering based on date order
I have a form which renders and inserts a component into a timeline, but I can't figure out how to get it to render a new submission chronologically, so that it gets inserted in the correct order.
This is what I've been trying so far.
render() {
…

gnado
- 23
- 3
2
votes
0 answers
react_component in twig generate : "ReferenceError: window is not defined"
I am currently experiencing a problem with the reactJs + Symfony 4.3 + WebPack stack. I have error "ReferenceError: window is not defined"
Below is my code for package.jon, composer.json, webpack Config, controller symfony
Here is My…

FOKO THierry
- 241
- 3
- 12
2
votes
1 answer
gem react on rails: webpack.config.js
I use Rails 5.1 and the react_on_rails gem v10.0.2
I want to use css modules and css-loader and I'm wondering where to put the webpack.config.js - File?
As I see it the current version of the react_on_rails gem doesn't have the client directory…

Trinity76
- 665
- 1
- 6
- 20
2
votes
1 answer
react on rails / react intl
I am trying to implement i18n for a rails/react_on_rails project following this guide;
https://github.com/shakacode/react_on_rails/blob/master/docs/basics/i18n.md
I get the error "formatMessage is not defined", so I am probably missing something,…

hso
- 345
- 3
- 19
2
votes
3 answers
(React on Rails) The engine "node" is incompatible with this module. Expected version "..."
For those familiar with the react-on-rails gem, or more generally, yarn:
Just today I updated my Node version to 8.8.1 via Homebrew. Now, when I attempt to run bundle && yarn && foreman start -f Procfile.dev (or just yarn install), I get the…

CFitz
- 178
- 4
- 16
2
votes
0 answers
Importing a react component from a Rails engine into an application
I am using react_on_rails for developing a Rails Engine and an application.
I have written a rails engine which has a single component - NewComponent. It uses react_on_rails. This has been tested via the dummy application of the rails engine. I…

Alex Jose
- 278
- 3
- 17
2
votes
0 answers
How to pass props to redux store from a Rails 5 views
I cannot seem to understand the docs on how to pass props from views to redux store.
Registration.jsx
import configureStore from '../store/configureStore';
ReactOnRails.registerStore({
configureStore,
});
// This is how react_on_rails can see…

Sylar
- 11,422
- 25
- 93
- 166