Skip to content

Instantly share code, notes, and snippets.

@stockwellb
Created May 21, 2017 14:15
Show Gist options
  • Save stockwellb/a2a7e98999df0e037699a638c386901f to your computer and use it in GitHub Desktop.
Save stockwellb/a2a7e98999df0e037699a638c386901f to your computer and use it in GitHub Desktop.
ngrx code example for medium article
export function reducer(
state: State, action: Rate.Actions | Rates.Actions): State {
switch (action.type) {
case Rates.ActionTypes.LOAD: {
const rates = action.payload;
// return new state
}
case Rates.ActionTypes.LOAD_SUCCESS: {
const rates = action.payload;
// return new state
}
case Rate.ActionTypes.SELECT: {
const rate = action.payload;
// return new state
}
default: { return state; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment