gregberge / loadable-components

The recommended Code Splitting library for React ✂️✨
https://loadable-components.com
MIT License
7.7k stars 382 forks source link

React-snap integration #159

Closed yyynnn closed 5 years ago

yyynnn commented 6 years ago

Hi there!

So i'm trying to use react-snap wo SSR to prerender SPA and i have some loadable-components. Been using this entry:

...
import { loadableReady } from '@loadable/component'

const Render = () => (
  <Provider store={store}>
    <PersistGate loading={null} persistor={persistor}>
      <ConnectedRouter history={history}>
        <App />
      </ConnectedRouter>
    </PersistGate>
  </Provider>
)

const rootElement = document.getElementById('app')

if (rootElement.hasChildNodes()) {
  loadableReady().then(() => {
    hydrate(<Render />, rootElement)
  })
} else {
  render(<Render />, rootElement)
}

App loads fine, but post-build with react-snap results in this error: loadableReady() requires state, please use getScriptTags or getScriptElements server-side

cant i just pre render components client side?

gregberge commented 6 years ago

Hello @yyynnn why is it closed? Did you solve it? React snap is not yet supported but we would like to work on it.

yyynnn commented 5 years ago

@neoziro unfortunately no. Just realized that pre-render wont cut it. But will try to dig in deeper on other project.

gregberge commented 5 years ago

Hello, I close it. React Snap will not be supported at this time.