diff --git a/README.md b/README.md index ec78817c4c..273d4615a4 100755 --- a/README.md +++ b/README.md @@ -74,8 +74,21 @@ axios.get('/user', { .catch(function (error) { console.log(error); }); + +// Want to use async/await? Add the `async` keyword to your outer function/method. +async function getUser() { + try { + const response = await axios.get('/user?ID=12345'); + console.log(response); + } catch (error) { + console.error(error); + } +} ``` +> **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet +> Explorer and older browsers, so use with caution. + Performing a `POST` request ```js