Skip to content

Commit f187c00

Browse files
committed
don't use defaultProps to default to 'window' to avoid issues in server contexts
1 parent f9dc037 commit f187c00

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

modules/Media.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class Media extends React.Component {
1919
};
2020

2121
static defaultProps = {
22-
defaultMatches: true,
23-
targetWindow: window
22+
defaultMatches: true
2423
};
2524

2625
state = {
@@ -31,7 +30,7 @@ class Media extends React.Component {
3130

3231
componentWillMount() {
3332
let { query } = this.props;
34-
const { targetWindow } = this.props;
33+
const targetWindow = this.props.targetWindow || window;
3534

3635
if (typeof targetWindow !== "object") return;
3736

0 commit comments

Comments
 (0)