December 2019
Intermediate to advanced
598 pages
12h 21m
English
In this section, we are going to implement a reducer, which is responsible for changing the state in the store for a given action. Let's carry out the following steps:
import { Action, ActionCreator, Dispatch, Reducer, combineReducers } from 'redux';
const questionsReducer: Reducer<QuestionsState, QuestionsActions> = ( state = initialQuestionState, action) => { // TODO - Handle the different actions and return new state return state;};
The reducer takes in two parameters: one for the current state and another for the action that is being processed. The state will be undefined ...