T-Sajad / football-scores-app

1 stars 0 forks source link

Live data 2: Load from cache #8

Open josephjclark opened 8 months ago

josephjclark commented 8 months ago

This is the second step to getting your app to load live data.

We're still not going to call out to the server . First we're going to load from a cache.

Doing it this way means we won't hit the request limit on your server during development (which is good!)

Understand Local Storage

The browser has a sort of built in database called Local Storage. This allows you to save data for your website, so if the user closes the browser, data can be restored next time.

Take a look at MDN's docs on Web Storage (web storage is Local Storage, I think they renamed it) https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Client-side_storage

Use web storage

We're going to cheat, first off all.

now your app is:

Neat.