https://github.com/ripeworks/react-root
<Root /> that bootstraps react, redux, react-router, webpack, devServer, etc, etc
https://github.com/ripeworks/react-root
Last synced: 10 months ago
JSON representation
<Root /> that bootstraps react, redux, react-router, webpack, devServer, etc, etc
- Host: GitHub
- URL: https://github.com/ripeworks/react-root
- Owner: ripeworks
- Created: 2016-01-14T12:41:42.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-19T13:14:28.000Z (over 9 years ago)
- Last Synced: 2025-03-29T03:32:09.807Z (11 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React <Root />
> Because I don't want to deal with boilerplates and starters.
[](https://badge.fury.io/js/react-root)
## Install
```
$ npm install --save react-root
```
## Usage
```js
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 =
render(
,
document.getElementById('app')
)
```
See the [example](example) to see how easy it is to get started!
### Redux Devtools
Install the [Redux Devtools browser extension](https://github.com/zalmoxisus/redux-devtools-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`:
```js
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](https://github.com/ripeworks/superdevpack) Use react-root and superdevpack together for the quickest way to get started on a React project.