Skip to content

Instantly share code, notes, and snippets.

@agoldis
Created April 28, 2018 05:46
Show Gist options
  • Save agoldis/98f2177bae601ace5dac222acde61455 to your computer and use it in GitHub Desktop.
Save agoldis/98f2177bae601ace5dac222acde61455 to your computer and use it in GitHub Desktop.
redux - state structure change
/* other derived state methods */
const moveToApp = state =>
Object.defineProperties(state, {
users: {
get: function() {
return this.app.users;
},
enumerable: false,
configurable: true
},
books: {
get: function() {
return this.app.books;
},
enumerable: false,
configurable: true
},
comments: {
get: function() {
return this.app.comments;
},
enumerable: false,
configurable: true
}
});
export const deriveState = compose(
/* ... */
moveToApp
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment