Last active
January 7, 2018 17:03
-
-
Save denisraslov/dc62dcdfb45edfad29a5c66b93fb6f1e 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
function getInitialState() { | |
const state = {}; | |
// Let's suggest that APP is our global Backbone app instanse, | |
// that keeps some models and collections. | |
// We put the data from them into initial Redux state. | |
state.account = APP.models.account.attributes; | |
state.sellPoints = APP.collections.tasks.map(task => task.attributes); | |
return state; | |
} | |
// A root reducer for the Redux store | |
function rootReducer(state, action) { | |
if (!state) { | |
return getInitialState(); | |
} | |
// Handle other actions... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment