Skip to main content
100%

Data Fetcher (Asnyc/Await Promise.Then)

✓ Published1🌍 Public
Jjunxiangyao
Last edited Oct 28, 2020
Created on Oct 27, 2020
Forked from HTML Starter

This example demonstrates two techniques for fetching remote data in JavaScript and logging the results to the console. The page uses the Fetch API to retrieve a CSV file of CSS named colors from a GitHub gist, with the data returned as raw text. The code contrasts the use of `async`/`await` syntax within an `async function` against the older `Promise` chaining approach via `.then()` methods. Both methods successfully retrieve the same resource, while a plain `console.log` statement prints a separate message to show the order of execution. The example is implemented as a minimal HTML page inside a React project scaffold.

AI-generated description

A bare minimum HTML page.

See also React Starter.

MIT Licensed

Similar vizzes