Last active
August 19, 2025 17:07
-
-
Save Klerith/060281f76f3b7f0a458e4b83b1fc0062 to your computer and use it in GitHub Desktop.
Revisions
-
Klerith revised this gist
May 13, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ import { createSlice } from '@reduxjs/toolkit'; export const templateSlice = createSlice({ name: 'name', initialState: { counter: 10 @@ -19,5 +19,5 @@ export const templaceSlice = createSlice({ // Action creators are generated for each case reducer function export const { increment } = templateSlice.actions; -
Klerith created this gist
May 13, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ import { createSlice } from '@reduxjs/toolkit'; export const templaceSlice = createSlice({ name: 'name', initialState: { counter: 10 }, reducers: { increment: (state, /* action */ ) => { //! https://react-redux.js.org/tutorials/quick-start // Redux Toolkit allows us to write "mutating" logic in reducers. It // doesn't actually mutate the state because it uses the Immer library, // which detects changes to a "draft state" and produces a brand new // immutable state based off those changes state.counter += 1; }, } }); // Action creators are generated for each case reducer function export const { increment } = templaceSlice.actions;