---
title: "Discussion on \"Handle API Calls Using async await Inside the useEffect Hook in React\" | Hashnode"
description: "Discussion on \"Handle API Calls Using async await Inside the useEffect Hook in React\". If you are a fan of async await syntax, then you might try using it in useEffect hook in React, but it does not work as expected. In this article, we will see how to handle that.\nLet’s write some code using promises first and then we will convert it ..."
url: "https://hashnode.com/posts/handle-api-calls-using-async-await-inside-the-useeffect-hook-in-react/606802857f07b6328b5ddfc6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Handle API Calls Using async await Inside the useEffect Hook in React](https://blog.yogeshchavan.dev/handle-api-calls-using-async-await-inside-the-useeffect-hook-in-react?utm_source=hashnode&utm_medium=feed)

If you are a fan of async await syntax, then you might try using it in useEffect hook in React, but it does not work as expected. In this article, we will see how to handle that. Let’s write some code using promises first and then we will convert it ...

Apr 3, 2021 · 3 min read · blog.yogeshchavan.dev  
Updated Apr 26, 2021  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#codenewbies](https://hashnode.com/tag/codenewbies)

## Written by

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

@myogeshchavan97 · India

  
[View profile](https://hashnode.com/@myogeshchavan97)

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. https://yogeshchavan.dev/. Book 1:1 @ hiretheauthor.com/myogeshchavan97

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. Loves sharing knowledge through technical articles. Dev.to: https://dev.to/myogeshchavan97 https://linktr.ee/myogeshchavan97

## Responses 3

Markdown supported · ⌘↵ to post

[Deepak Rawat](https://hashnode.com/@abcdeepakr)

[Sep 27, 2021](https://hashnode.com/posts/handle-api-calls-using-async-await-inside-the-useeffect-hook-in-react/606802857f07b6328b5ddfc6/comment/615219f3040ee87236950732)

hey Yogesh, lovely article anyhow I have a doubt regarding API calls from react, is it secure if I am fetching data with basic auth, is the application secure if I store the API key as env variables? Any sort of help will be appreciated :)

[Nimalan](https://hashnode.com/@nimalan)

[Aug 10, 2021](https://hashnode.com/posts/handle-api-calls-using-async-await-inside-the-useeffect-hook-in-react/606802857f07b6328b5ddfc6/comment/611207f99584520c481f586e)

Great One! Solved all my doubts on useEffect. Thanks [Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Aug 10, 2021](https://hashnode.com/posts/handle-api-calls-using-async-await-inside-the-useeffect-hook-in-react/606802857f07b6328b5ddfc6/comment/611207f99584520c481f586e#reply-611215969584520c481f594c)

Glad it was helpful to you. Thank you 🙂

[Mohammad Bilal](https://hashnode.com/@Bilal007)

[Apr 4, 2021](https://hashnode.com/posts/handle-api-calls-using-async-await-inside-the-useeffect-hook-in-react/606802857f07b6328b5ddfc6/comment/60697c3ab17dc439b747af41)

It's really helpful.... looking forward to more such content especially about useContext and useReducer

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Apr 5, 2021](https://hashnode.com/posts/handle-api-calls-using-async-await-inside-the-useeffect-hook-in-react/606802857f07b6328b5ddfc6/comment/60697c3ab17dc439b747af41#reply-606abe72b17dc439b747c794)

Thank you [Mohammad Bilal](https://hashnode.com/@Bilal007). Check out my [this article](https://blog.yogeshchavan.dev/a-complete-introduction-to-react-hooks) for React hooks introduction along with useReducer hook.

Article for useContext hook will be published soon.
