DEV Community

Discussion on: Alpine.js: Displaying API data in a HTML table

Collapse
 
nasoma profile image
nasoma

Great stuff! Is there a way to cache the data so that we don't make a new request every time.

Collapse
 
jamesli2021 profile image
jamesli2021 • Edited

Session or Local storage are the mechanism for caching per session or long-term.

You can cache .json file within browser for a long-time if the origin source header have set how long it will be cache.

Or build your own local web server in your machine like a CDN way and mirror JSON or etc, it's simple.