DEV Community 👩‍💻👨‍💻

Cover image for Using the Fetch API

Posted on

Using the Fetch API

Fetching a JSON file across the network and printing it to the console

<div id="posts">...</div>
        const API = 'https://';

        const postElement = document.querySelector('#posts');
        let page = 0;

        .then(response => {
            return response.json();

        .then(posts => {}
        .catch(error => console.error(error));
Enter fullscreen mode Exit fullscreen mode

as a result

Image description

Oldest comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.