Hacker News new | ask | show | jobs
by ng12 2247 days ago
> Personally, I strongly prefer hooks to HOCs.

To me this is the most visible win. useSelector for Redux, useIntl for react-intl, useHistory for react-router, useStyles for material-ui, etc. Almost every library I use radically simplified their API by adopting hooks.

1 comments

It also makes types much easier to analyze (whether using, say, VSCode's inference or Typescript) when using hooks. With HOCs, types tended to get lost through the arbitrary amount of <Wrapped {...props} /> chains.