Skip to content

Instantly share code, notes, and snippets.

@mattcarbone
Created January 21, 2018 18:11
Show Gist options
  • Save mattcarbone/b6fdd8c4e683ca99032f76c586082b4b to your computer and use it in GitHub Desktop.
Save mattcarbone/b6fdd8c4e683ca99032f76c586082b4b to your computer and use it in GitHub Desktop.
import { postsActions } from '../actions/posts'
import { handleActions } from 'redux-actions'
const initialState = []
const handlers = {
[postsActions.posts.set]: (state, action) => action.posts,
[postsActions.posts.append]: (state, action) => [...state, ...action.post]
}
export const postsReducer = handleActions(handlers, initialState)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment