From 2249cfcd5565b74306cd9e1e658505dc12ad98b6 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Wed, 5 Jun 2024 19:36:10 +0800 Subject: [PATCH] fix(use-media-query): named export, jsdoc --- src/use-media-query/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/use-media-query/index.ts b/src/use-media-query/index.ts index a34000d6..2ec76cf1 100644 --- a/src/use-media-query/index.ts +++ b/src/use-media-query/index.ts @@ -29,7 +29,8 @@ const getServerSnapshotWithoutServerValue = () => { throw noSSRError('useMediaQuery cannot be used on the server without a serverValue'); }; -const useMediaQuery = (mq: string, serverValue?: boolean | undefined): boolean => { +/** @see https://foxact.skk.moe/use-media-query */ +export const useMediaQuery = (mq: string, serverValue?: boolean | undefined): boolean => { if (typeof window !== 'undefined' && !externalStore.has(mq)) { // This part of the code should only run once per media query, on client-side only // since we are on the client-side, let's get initial value directly from DOM @@ -51,5 +52,3 @@ const useMediaQuery = (mq: string, serverValue?: boolean | undefined): boolean = return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); // Use useSyncExternalStore to manage the subscription and state }; - -export default useMediaQuery;