Skip to content

Commit 9febc24

Browse files
committed
Update docs.
1 parent f367890 commit 9febc24

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,18 @@ Firstly, you need to use our helper to allow your application to use asynchronou
3434
```jsx
3535
import { withAsyncComponents } from 'react-async-component'; // 👈
3636

37-
// Declare your application as normal.
3837
const app = <MyApp />;
3938

40-
// Then provide it to our helper, which returns a Promise.
4139
// 👇
42-
withAsyncComponents(app).then((result) => {
43-
// 👆 it resolves a "result" object
44-
const {
45-
// ❗️ We return a new version of your app that supports
46-
// asynchronous components. 💪
47-
appWithAsyncComponents
48-
} = result;
49-
50-
// 🚀 render it!
51-
ReactDOM.render(appWithAsyncComponents, document.getElementById('app'));
52-
});
40+
withAsyncComponents(app) // returns a Promise
41+
.then((result) => {
42+
ReactDOM.render(
43+
// We return a new version of your app that supports
44+
// asynchronous components.
45+
result.appWithAsyncComponents, // 👈
46+
document.getElementById('app')
47+
);
48+
});
5349
```
5450

5551
Next up, let's make an asynchronous Component! We provide another helper for this.
@@ -58,8 +54,7 @@ Next up, let's make an asynchronous Component! We provide another helper for th
5854
import { createAsyncComponent } from 'react-async-component'; // 👈
5955

6056
const AsyncProduct = createAsyncComponent({
61-
// Provide a function that will return a Promise that resolves
62-
// as your Component.
57+
// Provide a function that returns a Promise to the target Component.
6358
resolve: function resolveComponent() {
6459
return new Promise(function (resolve) {
6560
// The Promise the resolves with a simple require of the

0 commit comments

Comments
 (0)