Skip to content

Instantly share code, notes, and snippets.

@denisraslov
Last active January 7, 2018 17:03
Show Gist options
  • Save denisraslov/dc62dcdfb45edfad29a5c66b93fb6f1e to your computer and use it in GitHub Desktop.
Save denisraslov/dc62dcdfb45edfad29a5c66b93fb6f1e to your computer and use it in GitHub Desktop.
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