Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Make useMedia options an optional param
Browse files Browse the repository at this point in the history
  • Loading branch information
melnikov-s committed Jul 16, 2024
1 parent 3319e32 commit 0fc2d54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/orange-rabbits-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/react-hooks': minor
---

Make useMedia options an optional param
2 changes: 1 addition & 1 deletion packages/react-hooks/src/hooks/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0fc2d54

Please sign in to comment.