Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 53dd526

Browse files
committed
allow emotion to hydrate ssr css
1 parent 3607db6 commit 53dd526

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/common/header/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Router, { withRouter } from 'next/router';
33
import Headroom from 'react-headroom';
44
import NProgress from 'nprogress';
55
import Link from 'next/link';
6+
import { hydrate } from 'react-emotion';
67

78
import MetaInfo from '../../../config/meta-info';
89
import { Container } from '../../../utils/base.styles';
@@ -23,9 +24,9 @@ Router.onRouteChangeError = () => {
2324

2425
// Adds server generated styles to emotion cache.
2526
// '__NEXT_DATA__.ids' is set in '_document.js'
26-
// if (typeof window !== 'undefined' && window.__NEXT_DATA__) {
27-
// hydrate(window.__NEXT_DATA__.ids);
28-
// }
27+
if (typeof window !== 'undefined' && window.__NEXT_DATA__) {
28+
hydrate(window.__NEXT_DATA__.ids);
29+
}
2930

3031
class NavBar extends React.Component {
3132
state = {

0 commit comments

Comments
 (0)