aboutsummaryrefslogtreecommitdiff
path: root/src/counterSlice.ts
diff options
context:
space:
mode:
authorMax Nanis2025-06-06 16:32:17 +0700
committerMax Nanis2025-06-06 16:32:17 +0700
commit696dee6a6a9506fcf771d0ec4911dcc82a279fda (patch)
tree3e8d0bde7cded0f3e1fba82e3af1f2253c06bcbf /src/counterSlice.ts
parent2f675eecec576b1ab17260e2513e1eec187a81d2 (diff)
downloadpanel-ui-696dee6a6a9506fcf771d0ec4911dcc82a279fda.tar.gz
panel-ui-696dee6a6a9506fcf771d0ec4911dcc82a279fda.zip
Lots of reducer work to organize active Question in redux state (rather than useState). Various UX/CSS checks for Pagination state.
Diffstat (limited to 'src/counterSlice.ts')
-rw-r--r--src/counterSlice.ts44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/counterSlice.ts b/src/counterSlice.ts
deleted file mode 100644
index 1482de1..0000000
--- a/src/counterSlice.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { createAsyncThunk, createSlice } from '@reduxjs/toolkit'
-import type { PayloadAction } from '@reduxjs/toolkit'
-
-// Define the TS type for the counter slice's state
-export interface CounterState {
- value: number
- status: 'idle' | 'loading' | 'failed'
-}
-
-// Define the initial value for the slice state
-const initialState: CounterState = {
- value: 0,
- status: 'idle'
-}
-
-// Slices contain Redux reducer logic for updating state, and
-// generate actions that can be dispatched to trigger those updates.
-export const counterSlice = createSlice({
- name: 'counter',
- initialState,
- // The `reducers` field lets us define reducers and generate associated actions
- reducers: {
- increment: state => {
- // Redux Toolkit allows us to write "mutating" logic in reducers. It
- // doesn't actually mutate the state because it uses the Immer library,
- // which detects changes to a "draft state" and produces a brand new
- // immutable state based off those changes
- state.value += 1
- },
- decrement: state => {
- state.value -= 1
- },
- // Use the PayloadAction type to declare the contents of `action.payload`
- incrementByAmount: (state, action: PayloadAction<number>) => {
- state.value += action.payload
- }
- }
-})
-
-// Export the generated action creators for use in components
-export const { increment, decrement, incrementByAmount } = counterSlice.actions
-
-// Export the slice reducer for use in the store configuration
-export default counterSlice.reducer \ No newline at end of file