/// import * as React from 'react'; import { connect } from 'react-redux'; import { reduxify } from './core'; interface IHelloWorldProps { field: string; step?: number; counter?: number; incr?: Function; decr?: Function; } @reduxify( (state, props) => ({ counter: (state[props.field] || 0) }), (dispatch) => ({ incr: (field, step) => { dispatch({ type: 'COUNTER_CHANGE', field, by: step }); }, decr: (field, step) => { dispatch({ type: 'COUNTER_CHANGE', field, by: -1 * step }); } }) ) export default class Counter extends React.Component { render() { var field = this.props.field, step = this.props.step || 1; return (

{this.props.counter}

); } }