1.0.1 • Published 8 years ago

@khirayama/react-circuit v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

React Circuit

Official React bindings for Circuit.

Installation

npm install --save @khirayama/react-circuit

Documentation

Documents

Examples

Ref: Examples

createStore({total: 0}, (state, action) => {
  switch (action.type) {
    case 'COUNT_UP':
      state.total += 1;
      break;
    case 'COUNT_DOWN':
      state.total -= 1;
      break;
    default:
      break;
  }
  return state;
});

export default class CountContainer extends Container {
  render() {
    return (
      <section>
        <h1>Count: {this.state.total}</h1>
        <CountButton onCountButtonClick={countUp(this.dispatch)}>Count up +1</CountButton>
        <CountButton onCountButtonClick={countDown(this.dispatch)}>Count down -1</CountButton>
      </section>
    );
  }
}