Clicked: {counter} times
); } } ``` #### Observing Many Stores ```js // We're gonna need some decorators import React from 'react'; import { observes } from 'redux'; // With multiple stores, you might want to specify a prop mapper as last argument. // You can also access `props` inside the prop mapper. @observes('CounterStore', 'TodoStore', (state, props) => ({ counter: state.CounterStore.counter, todos: state.TodoStore.todos })) export default class TodosWithCounter { /* ... */ } ``` #### Performing a Single Action ```js // We're gonna need some decorators import React from 'react'; import { performs } from 'redux'; // Gonna subscribe it @performs('increment') export default class IncrementButton { render() { const { increment } = this.props; // injected by @performs return ( ); } } ``` #### Performing Many Actions ```js // We're gonna need some decorators import React from 'react'; import { performs } from 'redux'; // With multiple actions, you might want to specify a prop mapper as last argument. // You can also access `props` inside the prop mapper. @performs('increment', 'decrement', (actions, props) => ({ increment: props.invert ? actions.decrement : actions.increment, decrement: props.invert ? actions.increment : actions.decrement })) export default class IncrementButton { /* .... */ } ``` ### Dispatcher #### Creating a hot-reloadable dispatcher ```js import * as stores from './stores/index'; import * as actions from './actions/index'; import { createDispatcher } from 'redux'; const dispatcher = module.hot && module.hot.data && module.hot.data.dispatcher || createDispatcher(); dispatcher.receive(stores, actions); module.hot.dispose(data => { data.dispatcher = dispatcher; }); export default dispatcher; ``` #### Attaching the dispatcher to the root component ```js import React from 'react'; import { provides } from 'redux'; import dispatcher from './dispatcher'; @provides(dispatcher) export default class App { /* ... */ } ```