Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fetch, async, await

Public visualization

Viewing a saved revision (read-only)

aa6669e86e914bfebb061110dde0c7e3

Fetch, async, await

0 stars0🌍 Public
114Hazel
Last edited Apr 24, 2022
Created on Apr 22, 2022

This example demonstrates how to fetch and read a CSV file of CSS named colors using modern JavaScript async/await syntax. The code defines an `async` function that uses the built-in `fetch` API to request data from a GitHub gist URL, then returns the response as plain text via the `.text()` method. The fetched text is logged to the browser console for inspection. The example highlights the contrast between chained `.then()` callbacks and the more readable `async`/`await` approach for handling asynchronous data loading.

AI-generated description

React Starter code.