redux-ey

1.1.2 • Public • Published

npm install redux-ey --save

// store/test.model.js
export default {
  namespace: 'test',
  state: {
    a: 1,
    b: 2
  }
};


// store/index.js
import { combineReducers } from 'redux';
import ReduxEy from 'redux-ey';
import test from './test.model';

export default combineReducers({

  test: ReduxEy(test)

})

// page/home.js
import * as React from 'react';
import { connect } from 'react-redux';

@connect(({ test }) => ({ test }))
class Home extends React.Component {
  upthetest() {
    let a = this.props.test.a;
    a++;
    this.props.dispatch({ type: 'test', payload: { a, b: 4 } });
  }
  render() {
    return (
      <div>
        <span onClick={() => this.upthetest()}>{this.props.test.a}</span>
      </div>
    );
  }
}
export default Home;

Readme

Keywords

none

Package Sidebar

Install

npm i redux-ey

Weekly Downloads

10

Version

1.1.2

License

ISC

Unpacked Size

63.9 kB

Total Files

6

Last publish

Collaborators

  • baishiup