DEV Community

Discussion on: useReducer() Hook: Let me dispatch it

Collapse
 
martinpham profile image
Martin Pham

Nice article!
However I’d like to add some ideas:

  • Instead of returning state on switch’s default, you might want to throw an Error instead. When someone dispatches an unknown action type, it should notice him.
  • Instead of destructuring the state everytime, you might want to try immerjs which is very handy and safer
Collapse
 
yadav_rajshekhar profile image
Rajshekhar Yadav

Thanks for sharing.
I have stared learning react -native. Before this I was Working as an Android Application developer. Feel free to provide the resources. I love to read them.
By the way whatever you guys are discussing. I love to learn from it.
Thanks again

Collapse
 
martinpham profile image
Martin Pham

If you have Java background, I believe you wouldn’t have any problem learning js/ts and react.

Keep moving!