rm two packages for hooks (#251)

* rm two packages for hooks

* fix navigation
This commit is contained in:
tmshv authored and GitHub committed 2026-02-08 13:31:58 +07:00
1 parent f4c5132d7c
commit dd9058b798
13 files changed
+188 -272

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import { useSyncExternalStore } from "react"
export function useMediaQuery(query: string, defaultValue = false): boolean {
return useSyncExternalStore(
(callback) => {
const mql = window.matchMedia(query)
mql.addEventListener("change", callback)
return () => mql.removeEventListener("change", callback)
},
() => window.matchMedia(query).matches,
() => defaultValue,
)
}