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;