Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSR not working anymore since 2.3.0 #272

Closed
hrasoa opened this issue Sep 3, 2021 · 2 comments
Closed

SSR not working anymore since 2.3.0 #272

hrasoa opened this issue Sep 3, 2021 · 2 comments

Comments

@hrasoa
Copy link

hrasoa commented Sep 3, 2021

I created a small app with razzle here: https://github.com/hrasoa/react-live

import React from 'react';
import {
  LiveProvider,
  LivePreview
} from 'react-live'

const App = () => (
  <LiveProvider code="<strong>Hello World!</strong>">
    <LivePreview />
  </LiveProvider>
);

export default App;

With [email protected]

<div id="root"><div><strong>Hello World!</strong></div></div>

From [email protected]

<div id="root"><div></div></div>
@jpdriver
Copy link
Contributor

hey @hrasoa -- thanks for opening this issue and for providing a sample app.

unfortunately due to changes introduced in 2.3.0 (the adoption of useEffect and useState hooks in <LiveProvider />), react-live no longer supports SSR.

however, this only affects the initial HTML sent from your server. once your app rehydrates on the client-side, everything will mount and work as expected.

@tujoworker
Copy link

Here is a PR that supports SSR ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants