@sample-stack/counter-module-browser
Version:
Sample core for higher packages to depend on
29 lines (28 loc) • 738 B
JavaScript
import {createSlice}from'@reduxjs/toolkit';// Import createSlice from Redux Toolkit
// Define initial state
const initialState = 0;
// Create a slice for the counter with `createSlice`
const connectedReactRouterCounterSlice = createSlice({
name: 'redux-data',
// A name, used in action types
initialState,
reducers: {
// The name of the reducer serves as the name of the action
increment(state) {
return state + 1;
},
decrement(state) {
return state - 1;
}
}
});
// Export the reducer
const {
reducer,
actions
} = connectedReactRouterCounterSlice;
// Export actions
const {
increment,
decrement
} = actions;export{decrement,reducer as default,increment};//# sourceMappingURL=index.js.map