paint-brush
Introduction to React Hooks and Why They are the Wrong Abstraction by@malerba118
697 reads
697 reads

Introduction to React Hooks and Why They are the Wrong Abstraction

by Austin Malerba6mDecember 14th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

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
Austin Malerba

Austin Malerba

@malerba118

I like JavaScript runtimes.

About @malerba118
LEARN MORE ABOUT @MALERBA118'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Austin Malerba HackerNoon profile picture
Austin Malerba@malerba118
I like JavaScript runtimes.

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite