Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 737 Bytes

File metadata and controls

35 lines (21 loc) · 737 Bytes

Global Cache

Include the file for a global cache.

import "./services/cache";

Or import functions for config and control.

import { clearCache, setAutoclear } from './services/cache';

setAutoclear(8);  // automatically clear cache every 8 hours

Caches GET calls until a non-idempotent operation occurs.

Can avoid cache with the fetch option cache.

const orders = await fetch("./orders", { cache: 'reload' })

Also 'no-store' and 'no-cache' options will force reload.

React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR.

npm create vite@latest my-react-app -- --template react-ts

npm install

npm run dev