DEV Community

Discussion on: You don't need useReducer

Collapse
 
stevematdavies profile image
Stephen Matthew Davies • Edited

Can you explain why you also used the memo hook? It seems to me the point of clarity you made and the unnecessary use of useReducer was somewhat obfuscated by that sneaky little inclusion ;)

Collapse
 
adamklein profile image
adam klein

Hi,
not trying to be sneaky, just concise :)
But if that's confusing I'll add a note to the article

I wanted to show 2 equivalent solutions, and because dispatch never changes I wanted to ensure that actions never change with useMemo