diff --git a/.changeset/orange-rabbits-juggle.md b/.changeset/orange-rabbits-juggle.md new file mode 100644 index 0000000000..88aec3107f --- /dev/null +++ b/.changeset/orange-rabbits-juggle.md @@ -0,0 +1,5 @@ +--- +'@shopify/react-hooks': minor +--- + +Make useMedia options an optional param diff --git a/packages/react-hooks/src/hooks/media.ts b/packages/react-hooks/src/hooks/media.ts index bb4ff276e9..3871615202 100644 --- a/packages/react-hooks/src/hooks/media.ts +++ b/packages/react-hooks/src/hooks/media.ts @@ -3,7 +3,7 @@ import {useState, useEffect, useLayoutEffect} from 'react'; type EffectHook = typeof useEffect | typeof useLayoutEffect; function createUseMediaFactory(useEffectHook: EffectHook) { - return (query: string, {initialValue}: {initialValue?: boolean}) => { + return (query: string, {initialValue}: {initialValue?: boolean} = {}) => { const [match, setMatch] = useState(() => initialValue === undefined ? window.matchMedia(query).matches