UNPKG

@sample-stack/counter-module-browser

Version:

Sample core for higher packages to depend on

22 lines (21 loc) 713 B
import {createSlice}from'@reduxjs/toolkit';// Import createSlice from Redux Toolkit // Define the initial state const initialState = { reduxCount: 1 }; // Create the slice const counterSlice = createSlice({ name: 'counter', // the name of your slice, used in action types initialState, reducers: { // Define the reducer and automatically generate associated action increment: (state, action) => { state.reduxCount += action.payload; // Immer allows us to "mutate" the state } } }); // Export the reducer, generated from the slice const counterReducer = counterSlice.reducer; // Export the action creators counterSlice.actions;export{counterReducer};//# sourceMappingURL=index.js.map