react-rails

Load fonts from node_modules in react-rails application with webpack

ぐ巨炮叔叔 提交于 2019-12-11 15:44:10
问题 I have a react-rails application set up with webpacker. I am trying to load font-awesome-pro with it's fonts from node_modules. I assume this is a trivial task but I can't seem to find any good documentation on how to do this. This is what I have so far: package.json dependencies: "dependencies": { "@rails/webpacker": "3.5", "babel-preset-react": "^6.24.1", "bootstrap": "^4.1.3", "prop-types": "^15.6.2", "react": "^16.5.2", "react-dom": "^16.5.2", "react-slick": "^0.23.1", "react_ujs": "^2.4

How can I use this React library with React-Rails

风流意气都作罢 提交于 2019-12-11 04:48:57
问题 I came upon this: https://github.com/ssorallen/turbo-react And I like what it does, I am just a bit confused about how I use this code within my Rails project that currently uses the React-Rails gem I am mostly confused about where to put the code so that I can read it into my Rails gem with React Rails. If I paste the main JS file into my vendor/assets folder, I get this message: Uncaught ReferenceError: global is not defined I know that I am just fundamentally misunderstanding how to

how to use npm packages in rails

て烟熏妆下的殇ゞ 提交于 2019-12-10 13:39:29
问题 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 been able to get bower components working with bower-rails gem but never got npm packages to work. Is there a way to use this just through the asset pipeline (through vendor)? By the way, I'm not using browserify or ES6 so I don't even have import

Input field doesn't receive keyboard events when rendering with value property?

半城伤御伤魂 提交于 2019-12-08 05:11:29
I am using react-rails gem to work with ReactJS for Rails. The weird thing is if I set a non-empty value property when rendering React component, the input field won't receive any keyboard event This doesn't work! React.DOM.input type: 'text' className: 'form-control' value: "ABC" But it works React.DOM.input type: 'text' className: 'form-control' value: "" Any idea guys? Thanks a lot! I have answered to one question similar to this, i don't know how to share that answer to you. So i am re-typing that. In react, the component render's only when the state changes. Whenever the state of the

ReactJS form validation when state is not immediately updated

折月煮酒 提交于 2019-12-04 23:24:20
问题 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 components. Here is the code. var constraints = { email: { presence: true, email:true }, password: { presence: true, length: { minimum: 5 } } } var RegistrationForm = React.createClass({ getInitialState: function() { return { data: {}, errors: {} }; },

ReactJS form validation when state is not immediately updated

こ雲淡風輕ζ 提交于 2019-12-03 14:22:28
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 components. Here is the code. var constraints = { email: { presence: true, email:true }, password: { presence: true, length: { minimum: 5 } } } var RegistrationForm = React.createClass({ getInitialState: function() { return { data: {}, errors: {} }; }, changeState: function () { this.setState({ data: { email: this.refs.email.getDOMNode().value, password:

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

跟風遠走 提交于 2019-11-30 07:35:14
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 'https://rails-assets.org' do gem 'rails-assets-material-ui' end And I have required the library in my application.js file like so: //= require material-ui However I keep getting the error "couldn't find file 'material-ui". How can I use the material-ui component library in my Rails app with the react-rails gem? Ok so here is what I have working so far... to the

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

不问归期 提交于 2019-11-29 09:36:30
问题 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 'https://rails-assets.org' do gem 'rails-assets-material-ui' end And I have required the library in my application.js file like so: //= require material-ui However I keep getting the error "couldn't find file 'material-ui". How can I use the material-ui component