Rehydration in SSR with ES6 Imports
levsthings opened this issue · 0 comments
levsthings commented
Based on the discussions in #37, the following approach still seems to be only viable option to rehydrate if you're using ES6 imports:
import React from 'react'
import ReactDOM from 'react-dom'
import { rehydrate } from 'glamor'
rehydrate(window._glam)
const App = require('components/App/App').default
ReactDOM.render(<App />, document.getElementById('root'))
This is a workaround for the order of execution and if you only use ES6 imports instead, you get duplicate styles.
Users are warned about this caveat in the docs, but I'm just wondering if anyone has come up with a better solution since last time this was discussed?