Last active
March 18, 2016 07:31
-
-
Save mbensch/830af5e065b2d69b1fb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '../../core'; | |
import AppContainer from './AppContainer.jsx'; | |
const AppModule = new Module('App'); | |
AppModule | |
.setInitialState({ counter: 0 }) | |
// This will create Action Types (with normalized names) and Action Creators. | |
// The application container which is a wrapper around the redux store will | |
// compose all reducers of registered modules. The module name is used as key in the | |
// application state. | |
.on('INCREMENT_COUNTER', (state) => ({ counter: state.counter + 1 })) | |
.on('DECREMENT_COUNTER', (state) => ({ counter: state.counter - 1 })) | |
// The container component is the component that talks to the store. | |
// Module.getContainer() will return an instance of the component that | |
// is automatically bound to state and actions via react-redux bindings | |
.setContainer(AppContainer) | |
// This is the main route to the module's container component | |
// routes to submodules can be added via Module.addRoutes(route) | |
// with route being a react-redux-router routes object. | |
// addRoute() can be called multiple times and all routes will be composed | |
// into a single routes object. | |
.setIndexRoute('/'); | |
export default AppModule; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how do you use a
redux-thunk
? Inside thunked callback there is only root state, so, module should knows how to get its own state from the root of application. Is it resolved by your module system?