Introduction to React Hooks and Why They are the Wrong Abstraction by@malerba118
681 reads

Introduction to React Hooks and Why They are the Wrong Abstraction

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

An alternative API is a bit verbose, but it is less computationally wasteful, more conceptually accurate, and it's framework agnostic. I propose an alternative API that is as capable, but with fewer caveats. Hooks are static through the lifetime of a component and should be declared on component construction instead of during the render phase. Hook's placement during a component's first render determines where the hooks must be found by React on every subsequent render. React uses lint rules and will throw errors to try to prevent developers from violating this detail of hooks. This becomes problematic when our components become bloated with lots of state and logic.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Introduction to React Hooks and Why They are the Wrong Abstraction
Austin Malerba HackerNoon profile picture

@malerba118

Austin Malerba


Receive Stories from @malerba118

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa