Last active
January 29, 2018 12:32
-
-
Save fatso83/1915dadf943b66479ebdaa27dd945c3a to your computer and use it in GitHub Desktop.
Reselect test for redux - various versions
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
// 2 compares, 1 render, 1 new prop | |
export const getAuditLogsAsList = createSelector( | |
state => state.auditLogs.byId, | |
logDict => values(logDict) | |
); | |
// 4 compares, 1 render, 3 new props | |
export const getAuditLogsAsList = createSelector( | |
state => values(state.auditLogs.byId), | |
identity | |
); | |
export const getAuditLogs = state => state.auditLogs.byId; | |
// 2 compares, 1 render, 1 new prop | |
export const getAuditLogsAsList3 = createSelector( | |
getAuditLogs, | |
logDict => values(logDict) | |
); | |
const asList = createSelector( state => values(state.auditLogs.byId), identity); | |
// 2 compares, 1 render, 1 new prop | |
export const getAuditLogsAsList = createSelector( | |
state => asList(state), | |
identity | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment