32 lines
534 B
JavaScript
32 lines
534 B
JavaScript
import { configureStore, createSlice } from '@reduxjs/toolkit';
|
|
|
|
const slice = createSlice({
|
|
name: 'test',
|
|
initialState: {
|
|
part1: {
|
|
title: 'Hello World!',
|
|
x: 1,
|
|
},
|
|
part2: {
|
|
title: 'Hello OtherWorld!',
|
|
x: 2,
|
|
},
|
|
},
|
|
reducers: {
|
|
increment1: (state) => {
|
|
state.part1.x++;
|
|
},
|
|
increment2: (state) => {
|
|
state.part2.x++;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const actions = slice.actions;
|
|
|
|
const store = configureStore({
|
|
reducer: { test: slice.reducer },
|
|
});
|
|
|
|
export default store;
|