Created
January 19, 2020 15:54
-
-
Save vcapretz/8080c5d71586920e98bb4d35872040f9 to your computer and use it in GitHub Desktop.
Snippet used for showing an example in a blog post about Redux toolkit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createAction, createReducer, configureStore } from '@reduxjs/toolkit' | |
const increment = createAction('INCREMENT') | |
const decrement = createAction('DECREMENT') | |
const counter = createReducer(0, { | |
[increment]: state => state + 1, | |
[decrement]: state => state - 1 | |
}) | |
const store = configureStore({ reducer: counter }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment