Files
freeCodeCamp/common/app/toasts/redux/reducer.js
2016-07-28 23:40:01 -07:00

14 lines
335 B
JavaScript

import { handleActions } from 'redux-actions';
import types from './types';
const initialState = [];
export default handleActions({
[types.makeToast]: (state, { payload: toast }) => [
...state,
toast
],
[types.removeToast]: (state, { payload: key }) => state.filter(
toast => toast.key !== key
)
}, initialState);