Categories
JavaScript Answers

How to make a non-cached request with fetch and JavaScript?

Spread the love

To make a non-cached request with fetch and JavaScript, we set the cache option.

For instance, we write

const res = await fetch("some.json", { cache: "no-store" });

to call fetch to make a request to get some.json with a get request.

We set cache to 'no-store' to bypass the cache and get the latest version of some.json.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *