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

Top comments (0)

12 Rarely Used Javascript APIs You Need

>> Check out this classic DEV post <<