File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 11import * as React from 'react' ;
2- import { hydrate } from 'react-dom' ;
2+ import * as ReactDOM from 'react-dom' ;
33import App from './components/app' ;
44import { propsUrl , containerId } from './constants' ;
55
@@ -8,6 +8,6 @@ fetch(propsUrl)
88 . then ( ( props : AppProps ) => {
99 const app = ( < App { ...props } /> ) ;
1010 const el = document . getElementById ( containerId ) ;
11- const h = hydrate as any ;
12- h ( app , el ) ;
11+ const hydrate = ReactDOM . hydrate as any ;
12+ hydrate ( app , el ) ;
1313 } ) ;
Original file line number Diff line number Diff line change 11import { createServer } from 'http' ;
22import { createFactory } from 'react' ;
3- import { renderToNodeStream } from 'react-dom/server' ;
3+ import * as ReactDomServer from 'react-dom/server' ;
44import { readFile } from 'fs' ;
55import { promisify } from 'util' ;
66import AppComponent from './components/app' ;
@@ -33,6 +33,7 @@ createServer(async (req, res) => {
3333 <body>
3434 <div id="${ containerId } ">` ) ;
3535 const props : AppProps = { items : getItems ( ) } ;
36+ const renderToNodeStream = ReactDomServer . renderToNodeStream as any ;
3637 const stream = renderToNodeStream ( App ( props ) ) as any ;
3738 stream . pipe ( res , { end : false } ) ;
3839 stream . on ( 'end' , ( ) => {
You can’t perform that action at this time.
0 commit comments