From 4fe90ef0f2d78cee7eb702c212119363e754e584 Mon Sep 17 00:00:00 2001 From: Yuta Osawa Date: Fri, 14 Apr 2023 17:48:46 +0900 Subject: [PATCH] style: default export assigned variables --- core/use-swr.ts | 4 +++- immutable/index.ts | 4 +++- infinite/index.ts | 4 +++- mutation/index.ts | 7 ++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/core/use-swr.ts b/core/use-swr.ts index 0add15340..46a8f81c8 100644 --- a/core/use-swr.ts +++ b/core/use-swr.ts @@ -693,4 +693,6 @@ export const unstable_serialize = (key: Key) => serialize(key)[0] * } * ``` */ -export default withArgs(useSWRHandler) +const useSWR = withArgs(useSWRHandler) + +export default useSWR diff --git a/immutable/index.ts b/immutable/index.ts index d8ffd62b3..d39e8d6ba 100644 --- a/immutable/index.ts +++ b/immutable/index.ts @@ -10,4 +10,6 @@ export const immutable: Middleware = useSWRNext => (key, fetcher, config) => { return useSWRNext(key, fetcher, config) } -export default withMiddleware(useSWR, immutable) +const useSWRImmutable = withMiddleware(useSWR, immutable) + +export default useSWRImmutable diff --git a/infinite/index.ts b/infinite/index.ts index ccf6e318a..cfedb5a7d 100644 --- a/infinite/index.ts +++ b/infinite/index.ts @@ -324,7 +324,9 @@ export const infinite = ((useSWRNext: SWRHook) => } }) as unknown as Middleware -export default withMiddleware(useSWR, infinite) as SWRInfiniteHook +const useSWRInfinite = withMiddleware(useSWR, infinite) as SWRInfiniteHook + +export default useSWRInfinite export { SWRInfiniteConfiguration, diff --git a/mutation/index.ts b/mutation/index.ts index eb16c3a68..16637386f 100644 --- a/mutation/index.ts +++ b/mutation/index.ts @@ -146,7 +146,12 @@ const mutation = (() => * } = useSWRMutation(key, fetcher, options?) * ``` */ -export default withMiddleware(useSWR, mutation) as unknown as SWRMutationHook +const useSWRMutation = withMiddleware( + useSWR, + mutation +) as unknown as SWRMutationHook + +export default useSWRMutation export { SWRMutationConfiguration,