Loading the puzzle…
The puzzle IDE is built for a laptop or larger screen. You can read everything here, but selecting code is easier with a mouse and a wider window.
In packages/toolkit/src/, a slice is created with:
createSlice({
name: 'counter',
initialState: { value: 0 },
reducers: { added(state) { state.value += 1 } },
extraReducers: (builder) => {
builder
.addCase('counter/added', (state) => { state.value += 10 })
.addMatcher((action) => action.type.endsWith('/added'), (state) => { state.value *= 2 })
.addDefaultCase((state) => { state.value = -1 })
},
})
The slice's reducer is then called with the state { value: 0 } and the action
{ type: 'counter/added' }. Following the code from createSlice in createSlice.ts,
what is value in the state it returns? Select one option.
One of the listed options.
Each hint revealed before you solve takes 20 points off this puzzle's score.
Solve this puzzle to see the solution and a full explanation.
Pick one of the options.