Last active
October 22, 2017 16:04
-
-
Save oleg-webdev/2f665e425d89155e08b797de0ca6a330 to your computer and use it in GitHub Desktop.
async await simple example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fetchPosts = async () => { | |
| const res = await fetch("https://jsonplaceholder.typicode.com/posts/") | |
| const json = await res.json() | |
| return json | |
| } | |
| console.log(await fetchPosts()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment