Giter Club home page Giter Club logo

react-on-rails-simple's Introduction

react-on-rails-hot-minimal

A minimal React on Rails implementation of HMR with React Hot Loader 3, Redux, React Router 4, CSS modules and Webpack 2

Check out the demo

  • bundle install
  • cd client && yarn
  • foreman start
  • visit localhost:3000 and change source code to check out HMR

Essentials for Hot Module Replacement

  • in package.json
    • add "react-hot-loader"
  • in .babelrc
    • use es2015 preset, disable modules and add "react-hot-loader/babel" plugin
  • in webpack.config.js
    • add "react-hot-loader/patch" right before your root source file (e.g. client/entry in this rep) in to "entry" config
    • add new webpack.HotModuleReplacementPlugin() to plugins config
    • add hot: true (or hotOnly: true), and headers: { "Access-Control-Allow-Origin": "http://yourRailsHost" } (or just headers: { "Access-Control-Allow-Origin": "*" }) to devServer config
  • in your root source file (e.g. client/entry.js in this rep)
    • wrap your elements in AppContainer from react-hot-loader package
    • use module.hot.accept and specify modules and how they are going to be replaced

Check out the source code for more details.

react-on-rails-simple's People

Contributors

mongjong59 avatar casey1449 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.