File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -107,16 +107,25 @@ export default class BrowserRouter extends Router {
107107 this . unlistenHistroy ( ) ;
108108 }
109109
110+ get elScript ( ) {
111+ if ( this . stateFromServer !== null ) {
112+ const props = {
113+ id : '__react-router-async' ,
114+ dangerouslySetInnerHTML : {
115+ __html : `window.__REACT_ROUTER_ASYNC__=${ JSON . stringify ( { state : this . stateFromServer } ) } ;`
116+ }
117+ } ;
118+
119+ return < script { ...props } />
120+ }
121+ }
122+
110123 render ( ) {
111124 return (
112- < div >
125+ < React . Fragment >
113126 { this . props . children ? this . props . children : < this . state . Component { ...this . state . componentProps } /> }
114- { this . stateFromServer !== null ?
115- < script id = "__react-router-async" dangerouslySetInnerHTML = { { __html : `window.__REACT_ROUTER_ASYNC__=${ JSON . stringify ( {
116- state : this . stateFromServer
117- } ) } ;`} } /> : null
118- }
119- </ div >
127+ { this . elScript }
128+ </ React . Fragment >
120129 )
121130 }
122131}
You can’t perform that action at this time.
0 commit comments