2.0.5 • Published 8 years ago
gfs-redux-bind-react v2.0.5
gfs-redux-bind-react
bind react with redux
Usage
the BindReact component must have properties are module and reducers
moduleis areactcomponentreducersis a describe for action, normally it have afetchingprops
the devTools, middleware are optional
devToolsto set the react-dev-toolsmiddlewareaddreact-reduxmiddleware for this component
the following is full demo to describe how to use this, the detail please clone the code and run command
$ npm run testimport React, { Component ,PropTypes} from 'react';
import {render} from "react-dom";
import {BindReact} from 'gfs-redux-bind-react'
import Tools from 'gfs-redux-bind-react/lib/Tools'
import App from './container.jsx'
import * as reducers from '../reducers/index.es6';
import {LoadingBarComponent, Connect} from 'gfs-loadingbar/lib/index.react'
import {fetching} from 'gfs-loadingbar/lib/react/fetching'
import FetchMiddleware from 'gfs-loadingbar/lib/react/FetchMiddleware'
import createLogger from 'redux-logger'
const logger = createLogger()
//判断执行dev环境
render(
<BindReact module={App} reducers={{...reducers, fetching}} middleware={[FetchMiddleware, logger]} DevTools={Tools}>
<Connect>
<LoadingBarComponent />
</Connect>
</BindReact>,
document.getElementById('root')
);Developer
# test
$ npm run test
# build
$ npm run build
# run demo
$ npm start