diff --git a/src/useMedia.ts b/src/useMedia.ts index e3a5df884e..ae3968c314 100644 --- a/src/useMedia.ts +++ b/src/useMedia.ts @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; -const useMedia = (query: string, defaultState: boolean = false) => { - const [state, setState] = useState(defaultState); +const useMedia = (query: string) => { + const [state, setState] = useState(() => window.matchMedia(query).matches); useEffect(() => { let mounted = true;