DEV Community

Discussion on: Redux Basics Explained From A Beginner's Perspective

Collapse
 
favreleandro profile image
Leandro Favre

Good article! Just a point:

here you did:

export const reducer = (state = initialState, action) {
switch(action.type){
case 'ADD_NAME':
return {
...state,
names: [...names, action.payload]
}
default:
return state
}
}

But in the return of ADD_NAME, must be

names: [...state.names, action.payload]

the same in if...else structure.

Collapse
 
dylanmesty profile image
Dylan Mestyanek

Thank you so much for the correction, you're most definitely right! Slipped my mind - I got those changed in the article. I appreciate that, thanks again! :)

Collapse
 
favreleandro profile image
Leandro Favre

A pleasure! Thanks for sharing your article!