2.0.1 • Published 8 years ago

react-root v2.0.1

Weekly downloads
9
License
MIT
Repository
github
Last release
8 years ago

React <Root />

Because I don't want to deal with boilerplates and starters.

Install

$ npm install --save react-root

Usage

import React from 'react'
import { render } from 'react-dom'
import { Root, createStore } from 'react-root'

const middleware = [
  // any redux middleware you need
]

const reducers = {
  // object of your reducers
}

const store = createStore(middleware, reducers)

const routes = <Route path='/' component={App}>
  <Route path='home' component={Home} />
</Route>

render(
  <Root routes={routes} store={store} />,
  document.getElementById('app')
)

See the example to see how easy it is to get started!

Redux Devtools

Install the Redux Devtools browser extension.

Hot reloading your reducers

If you need to hot reload reducers in development, you can pass a function as the 4th parameter to creatStore in order to get the store instance so you can call replaceReducer. This function is only ever called if module.hot === true:

const store = createStore(middleware, reducers, storeEnhancers, store => {
  module.hot.accept('./reducers', () => {
    store.replaceReducer(require('./reducers').default)
  })
})

What's inside?

  • redux
  • react-redux
  • react-router
  • react-router-redux

Related Projects

  • superdevpack Use react-root and superdevpack together for the quickest way to get started on a React project.
2.0.1

8 years ago

2.0.0

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.2

9 years ago

0.0.1

9 years ago