Skip to content

Instantly share code, notes, and snippets.

@ngohungphuc
Last active November 28, 2018 15:52
Show Gist options
  • Select an option

  • Save ngohungphuc/4ddfe0de4d041c46f38e864a2aab007b to your computer and use it in GitHub Desktop.

Select an option

Save ngohungphuc/4ddfe0de4d041c46f38e864a2aab007b to your computer and use it in GitHub Desktop.
import {PortalActionsUnion, PortalActionTypes} from '../actions/portal.actions';
export interface PortalState {
comment: string;
}
export const initialState: PortalState = {
comment: 'some comments'
};
export function reducer(state: PortalState = initialState, action: PortalActionsUnion): PortalState {
switch (action.type) {
case PortalActionTypes.ADD_COMMENT:
return {
...state,
comment: action.payload
};
default:
return state;
}
}
export const getComments = (state: PortalState) => state.comment;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment