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.
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! :)
A pleasure! Thanks for sharing your article!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.
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! :)
A pleasure! Thanks for sharing your article!