diff --git a/README.md b/README.md index ff18d672..57aa12cc 100644 --- a/README.md +++ b/README.md @@ -6404,25 +6404,20 @@ Learn to code and get hired with { - (async () => { - const result = await axios( - "http://hn.algolia.com/api/v1/search?query=react" - ); - - setData(result.data); - })(); + React.useEffect(() => { + fetch("http://hn.algolia.com/api/v1/search?query=react") + .then(response => response.json()) + .then(data => setData(data)) }, []); return ( @@ -6439,7 +6434,9 @@ Learn to code and get hired with