From 6e8519641f95d4c9c5c1dc6da575364737ab8721 Mon Sep 17 00:00:00 2001 From: Alexander Fedyashov Date: Tue, 17 Oct 2017 20:43:07 +0300 Subject: [PATCH] fix(Responsive): fix usage of `window` for SSR (#2209) --- src/addons/Responsive/Responsive.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/addons/Responsive/Responsive.js b/src/addons/Responsive/Responsive.js index d0c299c6f5..6f1d0add7a 100644 --- a/src/addons/Responsive/Responsive.js +++ b/src/addons/Responsive/Responsive.js @@ -7,6 +7,7 @@ import { eventStack, getElementType, getUnhandledProps, + isBrowser, META, } from '../../lib' @@ -55,7 +56,8 @@ export default class Responsive extends Component { constructor(...args) { super(...args) - this.state = { width: window.innerWidth } + + this.state = { width: isBrowser ? window.innerWidth : 0 } } componentDidMount() {