How to create React custom hooks for data fetching with useEffect

added by JavaScript Kicks
4/3/2019 7:03:17 AM


Background React 16.8 added a new API, Hooks. If you haven't learned hooks yet, go to the official site and read the entire document before continuing this article. This article is about how to create custom hooks for data fetching. As described in the roadmap, React is planning to release react-cache and Suspense for data fetching in the near future.