DEV Community

How to fetch data with React Hooks

Mario on February 21, 2021

Short reminder what React Hooks are, and here useState and useEffect hooks in detail. This blog article is about how to fetch data with React hook...
Collapse
 
psyduck profile image
psyduck • Edited

i always use empty array : useEffect(() => {}, []) it similars componentDidMount()

Collapse
 
mariokandut profile image
Mario • Edited

@psyduck , it really depends what your use case is. A cleanup should be always provided, you can also read more about it how-to-use-useeffect-hook-in-react/.