React-starter-kit: ReferenceError: window is not defined

Created on 26 May 2017  路  2Comments  路  Source: kriasoft/react-starter-kit

Getting this error after including element-react
import {Menu} from 'element-react'; import 'element-theme-default';

error

Most helpful comment

Looks like the element-react lib does not support server-side rendering.

How to render a component on client-side only? #186

All 2 comments

Looks like the element-react lib does not support server-side rendering.

How to render a component on client-side only? #186

This is really common trouble with client side components only. You should ask your package vendor for solution.
If package rely on client side features, you can create a wrap for it and make different code paths for server and client.
Best advice is to avoid libraries which cannot support ssr.

Was this page helpful?
0 / 5 - 0 ratings