Skip to content

Instantly share code, notes, and snippets.

@AllGistsEqual
Created February 22, 2021 20:04
Show Gist options
  • Save AllGistsEqual/5c8a988d0e167faf124d60ab08eea9da to your computer and use it in GitHub Desktop.
Save AllGistsEqual/5c8a988d0e167faf124d60ab08eea9da to your computer and use it in GitHub Desktop.
// File: src/redux/ducks/article.ts
const articleReducer = createReducer(initialState, (builder) => {
builder
.addCase(setArticlesStatus, (state, action) => {
const { status } = action.payload
state.status = status
})
.addCase(storeArticlesData, (state, action) => {
const { data } = action.payload
state.data = data
state.status = 'idle'
})
})
export default articleReducer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment