HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
vercel
swr
TypeScript2019–2022
vercel / swr

swr

React Hooks for Data Fetching

4Distinct people
4Mentions
0Explicit recommenders
32.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

React Hooks for Data Fetching

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 9–Nov 16 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/16/2026, 12:56:33 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year4 dated mentions

Observed mentions: 2019-11-08 07:54:08 UTC to 2022-12-10 03:23:13 UTC.

012019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC110
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101

What Hacker News says

1 sources
With `useSWR` the return type is export interface SWRResponse<Data = any, Error = any> { /** * The returned data of the fetcher function. */ data: Data | undefined /** * The error object thrown by the fetcher function. */ error: Error | undefined mutate: KeyedMutator<Data> isValidating: boolean isLoading: boolean } https://github.com/vercel/swr/blob/14956a840ac9b75fe321bf846... so if I check `isLoading` in my component then typescript isn't able to narrow/refine the type to something more specific since it isn't a sum type. While with react-query, it's a proper sum type that can be differentiated by checking `isLoading`. The type is actually quite long so here's just a bit export type QueryObserverResult<TData = unknown, TError = unknown> = | Query
Read the rest
ObserverIdleResult<TData, TError> | QueryObserverLoadingErrorResult<TData, TError> | QueryObserverLoadingResult<TData, TError> | QueryObserverRefetchErrorResult<TData, TError> | QueryObserverSuccessResult<TData, TError> export interface QueryObserverLoadingResult<TData = unknown, TError = unknown> extends QueryObserverBaseResult<TData, TError> { data: undefined error: null isError: false isIdle: false isLoading: true isLoadingError: false isRefetchError: false isSuccess: false status: 'loading' } https://github.com/TanStack/query/blob/9b21609350d9ad41faf5c... The key point in the type above is `isLoading: true` and `data: undefined`, which means if I check `isLoading === true`, then typescript knows the data is not available. SWR doesn't provide these guarantees.
In SWR 2.0 – React Hooks for Data Fetching

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.