Skip to content

Instantly share code, notes, and snippets.

@fatso83
Last active January 29, 2018 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatso83/1915dadf943b66479ebdaa27dd945c3a to your computer and use it in GitHub Desktop.
Save fatso83/1915dadf943b66479ebdaa27dd945c3a to your computer and use it in GitHub Desktop.
Reselect test for redux - various versions
// 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