Your Redux reducers take strongly typed actions as parameters. TypeScript will enforce that the reducer handles each action correctly based on its type.
In recent versions of Redux, the traditional createStore
method has been deprecated in favor of the configureStore
method from Redux Toolkit. Redux Toolkit simplifies the Redux setup and enforces best practices by default.
The exercise on the right uses configureStore
from Redux Toolkit.
itemsReducer
function in the lower editor (/reducer.ts
) to return a new version of the state
object with the string item either added, or set to "none"
.