paint-brush
Stale-While-Revalidate Data Fetching Composable with Vue 3 Composition APIby@maoberlehner
451 reads
451 reads

Stale-While-Revalidate Data Fetching Composable with Vue 3 Composition API

by Markus Oberlehner5mJune 9th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Stale-while-revalidate data fetching composable for Vue 3 is inspired by React Hooks and SWR. The data is always in sync, even if a new component is added, it immediately has access to the cached data while fetching a fresh copy in the background. Every instance that resolves to the same cache key shares the same reactive object, so if one component triggers a reload, the data is updated everywhere. This is a quite raw implementation and in no way as comprehensive as React Query or SWR.

Company Mentioned

Mention Thumbnail
featured image - Stale-While-Revalidate Data Fetching Composable with Vue 3 Composition API
Markus Oberlehner HackerNoon profile picture
Markus Oberlehner

Markus Oberlehner

@maoberlehner

L O A D I N G
. . . comments & more!

About Author

Markus Oberlehner HackerNoon profile picture
Markus Oberlehner@maoberlehner

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite