Created
April 28, 2018 05:46
-
-
Save agoldis/98f2177bae601ace5dac222acde61455 to your computer and use it in GitHub Desktop.
redux - state structure change
This file contains hidden or 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
/* 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