Skip to content

Instantly share code, notes, and snippets.

@productioncoder productioncoder/index.js
Last active Oct 8, 2018

Embed
What would you like to do?
Using Reselect in a Redux project
import {createSelector} from 'reselect';
export default function (state = {}, action) {
switch (action.type) {
case UPDATE_FIRST_NAME:
return {
...state,
firstName: action.firstName
};
case UPDATE_LAST_NAME:
return {
...state,
firstName: action.lastName
};
default:
return state;
}
}
export const getFullName = createSelector(
(state) => state.firstName,
(state) => action.lastName,
(firstName, lastName) => [firstName,lastName].join(' ')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.