Cache Like a Pro! TanStack Query v5 Stale Time & GC Strategy
CODE PREVIEW
エディタを読み込み中…
P
Prompt
Build a live demo showing staleTime, gcTime, and cache invalidation in TanStack Query v5. Use a fake API with react-query Devtools.
TanStack Query v5 では、staleTime と gcTime でキャッシュの鮮度と寿命を細かくコントロールできます。このデモでは、ミューテーションを実行すると自動的にキャッシュが無効化され、その後10秒間は古いデータを表示しないようになる様子を確認できます。Devtools でキャッシュの状態をリアルタイムに観察してください。
Prompt Overview
TanStack Query v5 gives you fine-grained control over caching with staleTime and gcTime. This demo shows how a mutation invalidates the query automatically, and how the cache stays fresh for 10 seconds. Use the Devtools to see the cache entries in real time.
Was this prompt helpful?
Comments
Comments appear after moderation
この記事が役に立ったら投げ銭で応援
Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済
開発者が選ぶ最強ツール集
運営者が毎日使っているツール・ガジェット 6選