You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
753 B

import { configureStore, createSlice } from '@reduxjs/toolkit'
import connSlice from '@/store/conn'
import userSlice from '@/store/user'
const counterSlice = createSlice({
name: 'counter',
initialState: { value: 0 },
reducers: {
increment: state => {
state.value += 1
},
incrementByAmount: (state, action) => {
state.value += action.payload
}
}
})
// redux-toolkit: https://redux-toolkit.js.org/usage/immer-reducers
const store = configureStore({
reducer: {
counter: counterSlice.reducer,
conn: connSlice.reducer,
user: userSlice.reducer,
}
})
export default store
export const { increment, decrement, incrementByAmount } = counterSlice.actions