DEV Community

Discussion on: React custom hook to fetch data

Collapse
 
eissorcercode99 profile image
The EisSorcer

So without reading the full article on hooks and looking them up: can it be said that hooks are constructed similar to promises in that our first parameter acts as it's "resolve," and it's second param as it's "reject?"

Collapse
 
abhmohan profile image
abhmohan

Not exactly. In this article I just tried to demonstrate how we can make use of react hooks to our advantage. This is one of the scenarios where I just created a custom hook and how we can use them in different components.

Custom hook does not necessarily have to fetch data. You can use them as per your use case. Hope I made it clear.