added orai
This commit is contained in:
26
20250312/my-app/app/components/CounterSlice.ts
Normal file
26
20250312/my-app/app/components/CounterSlice.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import {createSlice} from "@reduxjs/toolkit";
|
||||
|
||||
interface CounterState {
|
||||
value: number;
|
||||
}
|
||||
|
||||
const initialState: CounterState = {
|
||||
value: 0,
|
||||
};
|
||||
|
||||
const counterSlice = createSlice({
|
||||
name: "counter",
|
||||
initialState,
|
||||
reducers: {
|
||||
increment: (state) => {
|
||||
state.value += 1;
|
||||
},
|
||||
|
||||
decrement: (state) => {
|
||||
state.value -= 1;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {increment, decrement} = counterSlice.actions;
|
||||
export default counterSlice.reducer;
|
||||
Reference in New Issue
Block a user