2.0.5 • Published 6 years ago

gfs-redux-bind-react v2.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

gfs-redux-bind-react

bind react with redux

Usage

the BindReact component must have properties are module and reducers

  • module is a react component
  • reducers is a describe for action, normally it have a fetching props

the devTools, middleware are optional

  • devTools to set the react-dev-tools
  • middleware add react-redux middleware 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 test
import 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