@fay-react/lib
fay react lib
Last updated 5 months ago by fay462298322 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @fay-react/lib 
SYNC missed versions from official npm registry.

fay react lib

####工具库

Usage

npm i @fay-react/lib

fetch

import {get, put, post, remove, getJson, putJson, postJson, removeJson} from '@fay-react/lib/fetch';
get({path, data});
put({path, data, contentType, defaultQuery});
post({path, data, contentType});
remove({path, data, contentType});
  • getJson, putJson, postJson, removeJson对应get,put,post,remove的返回值转成JSON对象

按需加载(code splitting)

import Loadable  from '@fay-react/lib/loadable';

export default (props) => Loadable({
    view: () => import(/* webpackChunkName: "test" */'./views'),
    reducer: () => import(/* webpackChunkName: "testReducer" */'./reducer'),
    sagas: () => import(/* webpackChunkName: "testSagas" */'./sagas')
},props)
  • reducer和sagas为可选项,非必传
//reducer.js
import * as types from './actionType';
import reducerName from './reducerName'

const initState = {};

const reducer = (state = initState,action) => {
    const {type} = action;
    switch (type) {
        case types.INIT: {
            return {type}
        }
        default: {
            return state;
        }
    }
};

export default {
    [reducerName]: reducer
}

Provider

import React from 'react';
import {render} from 'react-dom';
import Root from './root';
import Provider from '@fay-react/lib/provider';

render(<Provider root={Root}/>, document.getElementById('app'));

Current Tags

  • 0.0.1-alpha.25                                ...           latest (5 months ago)

25 Versions

  • 0.0.1-alpha.25                                ...           5 months ago
  • 0.0.1-alpha.24                                ...           5 months ago
  • 0.0.1-alpha.23                                ...           5 months ago
  • 0.0.1-alpha.22                                ...           5 months ago
  • 0.0.1-alpha.21                                ...           5 months ago
  • 0.0.1-alpha.20                                ...           5 months ago
  • 0.0.1-alpha.19                                ...           5 months ago
  • 0.0.1-alpha.18                                ...           5 months ago
  • 0.0.1-alpha.17                                ...           5 months ago
  • 0.0.1-alpha.16                                ...           6 months ago
  • 0.0.1-alpha.15                                ...           6 months ago
  • 0.0.1-alpha.14                                ...           6 months ago
  • 0.0.1-alpha.13                                ...           6 months ago
  • 0.0.1-alpha.12                                ...           6 months ago
  • 0.0.1-alpha.11                                ...           6 months ago
  • 0.0.1-alpha.10                                ...           6 months ago
  • 0.0.1-alpha.9                                ...           6 months ago
  • 0.0.1-alpha.8                                ...           6 months ago
  • 0.0.1-alpha.7                                ...           6 months ago
  • 0.0.1-alpha.6                                ...           6 months ago
  • 0.0.1-alpha.5                                ...           6 months ago
  • 0.0.1-alpha.4                                ...           6 months ago
  • 0.0.1-alpha.3                                ...           6 months ago
  • 0.0.1-alpha.2                                ...           6 months ago
  • 0.0.1-alpha.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 26
Dev Dependencies (6)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |