We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c46802 commit 08d0ac1Copy full SHA for 08d0ac1
modules/Media.js
@@ -26,16 +26,17 @@ class Media extends React.Component {
26
this.setState({ matches: this.mediaQueryList.matches })
27
28
componentWillMount() {
29
+ if (typeof window !== 'object')
30
+ return
31
+
32
let { query } = this.props
33
34
if (typeof query !== 'string')
35
query = json2mq(query)
36
- if (typeof window === 'object') {
- this.mediaQueryList = window.matchMedia(query)
- this.mediaQueryList.addListener(this.updateMatches)
37
- this.updateMatches()
38
- }
+ this.mediaQueryList = window.matchMedia(query)
+ this.mediaQueryList.addListener(this.updateMatches)
39
+ this.updateMatches()
40
}
41
42
componentWillUnmount() {
0 commit comments