Skip to content

Commit 54adf7d

Browse files
committed
Updates docs.
1 parent cffd867 commit 54adf7d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,24 @@ Then on the "client" side you would do the following:
262262
```jsx
263263
import React from 'react';
264264
import { render } from 'react-dom';
265-
import { AsyncComponentProvider } from 'react-async-component'; // 👈
265+
import { AsyncComponentProvider, createAsyncContext } from 'react-async-component'; // 👈
266266
import asyncBootstrapper from 'react-async-bootstrapper'; // 👈
267267
import 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.
274278
const app = (
275-
<AsyncComponentProvider rehydrateState={rehydrateState}>
279+
<AsyncComponentProvider
280+
rehydrateState={rehydrateState}
281+
asyncContext={asyncContext}
282+
>
276283
<MyApp />
277284
</AsyncComponentProvider>
278285
);

0 commit comments

Comments
 (0)