Hi! I really enjoyed your article. The options pattern will help with a component of mine that didn't feel right.
I think the reducer example needs to be edited though:
selectItem
'reset'
'selectItem'
case
isOpen
inputValue
case "selectItem": return { ...state, isOpen: false, inputValue: action.payload.name, selectedItem: action.payload }
Thank you Sylvie and good catch! A bit too fast with the copy/paste it seems! :D Updated it now! 🙏
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.
Hi! I really enjoyed your article. The options pattern will help with a component of mine that didn't feel right.
I think the reducer example needs to be edited though:
selectItem
is'reset'
, I believe it should be'selectItem'
to match the reducer?case
forselectItem
do the same thing as the function?isOpen
andinputValue
won't change on their own. Or am I missing something?Thank you Sylvie and good catch! A bit too fast with the copy/paste it seems! :D Updated it now! 🙏