File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -262,17 +262,24 @@ Then on the "client" side you would do the following:
262262``` jsx
263263import React from ' react' ;
264264import { render } from ' react-dom' ;
265- import { AsyncComponentProvider } from ' react-async-component' ; // 👈
265+ import { AsyncComponentProvider , createAsyncContext } from ' react-async-component' ; // 👈
266266import asyncBootstrapper from ' react-async-bootstrapper' ; // 👈
267267import MyApp from ' ./components/MyApp' ;
268268
269269// 👇 Get any "rehydrate" state sent back by the server
270- const rehydrateState = window .ASYNC_COMPONENTS_STATE
270+ const rehydrateState = window .ASYNC_COMPONENTS_STATE ;
271+
272+ // Create an async context so that state can be tracked
273+ // 👇 across the bootstrapping and rendering process.
274+ const asyncContext = createAsyncContext ();
271275
272276// Ensure you wrap your application with the provider,
273277// 👇 and pass in the rehydrateState.
274278const app = (
275- < AsyncComponentProvider rehydrateState= {rehydrateState}>
279+ < AsyncComponentProvider
280+ rehydrateState= {rehydrateState}
281+ asyncContext= {asyncContext}
282+ >
276283 < MyApp / >
277284 < / AsyncComponentProvider>
278285);
You can’t perform that action at this time.
0 commit comments