August 2017
Beginner
374 pages
10h 41m
English
In the Redux world, it is best practice to use switch statements to handle multiple action types. Feel free to use if/else statements instead, especially when a reducer handles only a single action type:
switch (action.type) {
case CREATE_POST: { return ... } case EDIT_POST: { return ... }
Note how we don't use a string ('CREATE_POST'), but the action type/constant (CREATE_POST).
Read now
Unlock full access