paint-brush
What's The Right Way to Fetch Data in React Hooks? [A Deep Dive]by@Mathew
14,354 reads
14,354 reads

What's The Right Way to Fetch Data in React Hooks? [A Deep Dive]

by Jacob11mApril 22nd, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The React Hooks docs has a FAQ entry: “How can I do data fetching with Hooks?” where they link to this well written and detailed article by Robin Wieruch. There is however a shortcoming in that approach which affects correctness is some important situations. Using useEffect() to sync the state to a prop is problematic. The browser may briefly display out of sync data to the user before it updates to ‘loading…’ But there is a bigger issue. Bad data is passed to child components, but will get fixed before the paint.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - What's The Right Way to Fetch Data in React Hooks? [A Deep Dive]
Jacob HackerNoon profile picture
Jacob

Jacob

@Mathew

Founder/CEO Qurika

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

About Author

Jacob HackerNoon profile picture
Jacob@Mathew
Founder/CEO Qurika

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