Open david6076 opened 6 years ago
Hi there @ipmipest I see some spelling errors in the above code
line 3, the arguments to the function should be (state = null, action)
. You misspelled null
here
line 4, your switch statement should switch over the action type, not the state. The correct switch should be: switch(action.type)
Also on line 5, your case statement
should be a variable that should have been declared above as stated by the instructor to reduce errors. You should have something like:
const BOOK_SELECTED = 'BOOK_SELECTED'
...
export function(state = null, action) {
switch(action.type) {
case BOOK_SELECTED:
return action.payload;
}
return state
}
Keep up the good work!
reducer_active_book.js does not compile due to this error: ERROR in ./src/reducers/reducer_active_book.js Module build failed: SyntaxError: E:/Udemy-React/ReduxSection4StarterKit/ReduxSimpleStarter/src/reducers/reducer_active_book.js: Unexpected token (3:16)
1 | // State arg is not application state, only the state 2 | // this reducer is responsible for
@ ./src/reducers/index.js 13:27-59 webpack: Failed to compile.
What is the name of this function supposed to be? Cant progress any further in this lecture.