Skip to content

Files

Latest commit

831ce26 · Dec 31, 2015

History

History

hot-reloading

NuclearJS Hot Reloading

NuclearJS supports hot reloading of stores. Using the webpack Hot Module Replacement simply code like this to wherever your stores are registered.

import { Reactor } from 'nuclear-js'
import * as stores from './stores'

const reactor = new Reactor({
  debug: true,
})
reactor.registerStores(stores)

if (module.hot) {
  // Enable webpack hot module replacement for stores
  module.hot.accept('./stores', () => {
    reactor.replaceStores(require('./stores'))
  })
}

export default reactor

Running Example

npm install
npm start

Go to http://localhost:3000

Inpsiration & Thanks

Big thanks to redux and react-redux for proving out this architecture and creating simple APIs to accomplish hot reloading.