Home

Awesome

dva-model-extend

npm package NPM downloads Dependency Status

Utility method to extend dva model.

Installation

npm install --save dva-model-extend

Usage

import modelExtend from 'dva-model-extend';

const human = {
  state: {
    stomach: null,
  },
  reducers: {
    eat(state, { payload: food }) {
      return { ...state, stomach: food };
    },
  },
};

const benjy = modelExtend(human, {
  namespace: 'human.benjy',
  state: {
    name: 'Benjy',
  },
});

API

modelExtend(...models) => Model

Behaviour:

License

MIT