Wraps an SWR fetcher so its data arrives as enum instances, typed: useSWR('/orders/1', withEnums<Order>(fetchJson, { state: OrderState })).
useSWR('/orders/1', withEnums<Order>(fetchJson, { state: OrderState }))
Enum instances are singletons, so SWR's comparison sees a revalidation with the same payload as unchanged and keeps the same object.
Wraps an SWR fetcher so its data arrives as enum instances, typed:
useSWR('/orders/1', withEnums<Order>(fetchJson, { state: OrderState })).Enum instances are singletons, so SWR's comparison sees a revalidation with the same payload as unchanged and keeps the same object.