import { CategoriesActions , CategoriesActionTypes } from '../actions' ; export interface State { data : string [ ] ; } const initialState = { data : [ ] } ; export function reducer ( state = initialState , action ) { switch ( action . type ) { case CategoriesActionTypes . LoadSuccess : { return { ... state , data : action . payload . categories } ; } default : { return state ; } } } export const getData = ( state ) => state . data ;