import cloneObj from '../clone' ; type Actions = { type : string ; name : string ; data : any ; } ; type InitialState = { [ key ] : any ; } ; const initialState = { } ; export default ( state = cloneObj ( initialState ) , action ) => { switch ( action . type ) { case 'ADD_LIKE_LIST_BY_ID' : state [ action . name ] = action . data ; break ; case 'CLEAN' : state = { } ; break ; default : return state ; } return cloneObj ( state ) ; } ; export const getLikeListById = ( state , id ) => state . like [ id ] ;