How to download the same data with the API, though there is no change?

Here's the code that receives the data via the API:
async componentDidMount() {
 var URL = 'https://example.com/api/get/data/'; 
 await fetch(URL)
 .then((response) => response.text())
 .then(async (responseText) => { 
 await AsyncStorage.setItem('db_qs', responseText); 
})
 .catch((error) => {
console.warn(error);
});
}


Everything works, but the problem is that this code pulls the data each time even if they have not been changed.
I wouldn't want to make the application without the need for compete data on the Internet.
How it can be avoided?

I tried to check through the headers. Just check Content-Length and Date, but something is not working.

And how to cache this data to be stored and is not updated?
March 19th 20 at 08:38
2 answers
March 19th 20 at 08:40
How to download the same data with the API, though there is no change?

To request only new and changed data.
Thanks for the reply. This is good in theory. But really is there a website that gives a database in json format.
You want to take, and want to not take it. To request changes, I can not. - dedrick.Langworth11 commented on March 19th 20 at 08:43
March 19th 20 at 08:42
There is a type of web sockets connection in which the server itself can you send me the data when they changed, I don't know how suitable this option in your case, but from front to know when the server data has changed will not work, only on the server it is clear and it needs to notify the client part about it.

Find more questions by tags React Native