import { ApiResponseTrendingHashtags } from '../models/api-response' ; import * as apiActions from '../actions/api' ; prop export interface State { hashtags : ApiResponseTrendingHashtags ; } prop export const initialState = { hashtags : null } ; export function reducer ( state = initialState , action ) { switch ( action . type ) { case apiActions . ActionTypes . SEARCH_TRENDING_HASHTAGS_SUCCESS : { const apiResponse = action . payload ; return Object . assign ( { } , state , { hashtags : apiResponse } ) ; } case apiActions . ActionTypes . SEARCH_TRENDING_HASHTAGS_FAIL : { return Object . assign ( { } , state , { hashtags : null } ) ; } default : { return state ; } } } export const getHashtags = ( state ) => state . hashtags ;