DEV Community

Discussion on: React + Redux = React + Context

Collapse
 
josemunoz profile image
José Muñoz

I have a bit of an issue with this 3 lines:

const handlerarr = Object.keys(handlers);
  const modHanlders = {};
  handlerarr.map((h, i) => (modHanlders[h] = handlers[h](state, setState)));

It could be easily reduced to a single line without mutations:

  const modHandlers = Object.keys(handlers).map(key => handlers[key](state, setState))
Collapse
 
droidmakk profile image
Afroze Kabeer Khan. M

Could be done, Thanks for that. 😍😍
Changing it right away!