Skip to content

Commit

Permalink
fix(MediaQuery): enhance TypeScript types
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed May 31, 2023
1 parent ded7c9c commit d93bd54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const MediaQueryLiveExample = () => (
min: 'small',
max: 'large',
})

const match1 = useMediaQuery({
matchOnSSR: true,
when: query,
Expand All @@ -68,7 +69,11 @@ export const MediaQueryLiveExample = () => (
not: true,
when: query,
})
// console.log('mediaQuery:', match1, match2)

React.useEffect(() => {
console.log('mediaQuery:', match1, match2)
}, [match1, match2])

return (
<>
<Button
Expand Down
2 changes: 1 addition & 1 deletion packages/dnb-eufemia/src/shared/MediaQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ export default class MediaQuery extends React.PureComponent<

render() {
const { children } = this.props
return this.state.match ? children : null
return <>{this.state.match ? children : null}</>
}
}

0 comments on commit d93bd54

Please sign in to comment.