@@ -34,22 +34,18 @@ Firstly, you need to use our helper to allow your application to use asynchronou
3434``` jsx
3535import { withAsyncComponents } from ' react-async-component' ; // 👈
3636
37- // Declare your application as normal.
3837const 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
5551Next 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
5854import { createAsyncComponent } from ' react-async-component' ; // 👈
5955
6056const 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