My name is Kent C. Dodds and I'm a Remix Co-Founder, JavaScript engineer, and teacher. I'm also active in the open source community. I like my family, JavaScript, and React.
Well, personally I think useState() having a method of reseting state would be the 'simplest' solution...
useState(list.map(addExtraProp),[list]);
...but yes, I could lift the state out of the MembersList, and convert it to a fully controlled stateless component, and just reset the state in the handler for the Team's dropdown onChange. Definitely another good way to solve the problem.
I guess maybe I am the only one who ever felt like they wanted a way to reset the state in useState() or useReducer()
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.
I think the simplest solution to this problem is to Lift State Up no?
Well, personally I think
useState()
having a method of reseting state would be the 'simplest' solution......but yes, I could lift the state out of the
MembersList
, and convert it to a fully controlled stateless component, and just reset the state in the handler for theTeam
's dropdownonChange
. Definitely another good way to solve the problem.I guess maybe I am the only one who ever felt like they wanted a way to reset the state in
useState()
oruseReducer()