Skip to content

Commit 01fe31f

Browse files
committed
Updates docs.
1 parent 2e69ba6 commit 01fe31f

File tree

1 file changed

+13
-32
lines changed

1 file changed

+13
-32
lines changed

README.md

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ const AsyncProduct = createAsyncComponent({
2020

2121
- [Introduction](#introduction)
2222
- [Examples](#examples)
23-
- [Creating Async Components](#creating-async-components)
24-
- [Simple](#simple)
25-
- [With Loading Component](#with-loading-component)
26-
- [Webpack 1/2 `require.ensure` Code Splitting](#webpack-12-requireensure-code-splitting)
27-
- [Webpack 2 `import` / `System.import` Code Splitting](#webpack-2-import--systemimport-code-splitting)
28-
- [Defer Loading to the Client/Browser](#defer-loading-to-the-clientbrowser)
29-
- [End to End Examples](#end-to-end-examples)
30-
- [Browser Only Application](#browser-only-application)
31-
- [Server Side Rendering Application](#server-side-rendering-application)
23+
- [Browser Only Application](#browser-only-application)
24+
- [Server Side Rendering Application](#server-side-rendering-application)
25+
- [Using Loading Components](#using-loading-components)
26+
- [Webpack 1/2 `require.ensure` Code Splitting](#webpack-12-requireensure-code-splitting)
27+
- [Webpack 2 `import` / `System.import` Code Splitting](#webpack-2-import--systemimport-code-splitting)
28+
- [Defer Loading to the Client/Browser](#defer-loading-to-the-clientbrowser)
3229
- [API](#api)
3330
- [createAsyncComponent(config)](#createasynccomponentconfig)
3431
- [withAsyncComponents(element)](#withasynccomponentselement)
@@ -44,13 +41,11 @@ This library is an evolution of [`code-split-component`](). Unlike `code-split-c
4441

4542
## Examples
4643

47-
### End to End Examples
48-
4944
The below examples show off a full workflow of using the `createAsyncComponent` and `withAsyncComponents` helpers.
5045

51-
In all of our examples below we are going to be making use of the `System.import` API supported by Webpack v2 to do asynchronous resolution of our Components and create code split points.
46+
In some of the examples below we are going to be making use of the `System.import` API supported by Webpack v2 which provides us with code splitting on our asynchronous components.
5247

53-
#### Browser Only Application
48+
### Browser Only Application
5449

5550
This is how you would use `react-async-component` in a "browser only" React application.
5651

@@ -136,7 +131,7 @@ export default Root;
136131

137132
You have a lot more power than is shown here. Be sure to check out the [`API`](#api) and [`Examples`](#examples) sections for more.
138133

139-
#### Server Side Rendering Application
134+
### Server Side Rendering Application
140135

141136
In a "server side rendering" React application you can use the async components in the same manner as described above, but you need to make some adjustments to the way that you render the application on the server.
142137

@@ -219,21 +214,7 @@ withAsyncComponents(app)
219214
});
220215
```
221216

222-
### Creating Async Components
223-
224-
#### Simple
225-
226-
```jsx
227-
const AsyncProduct = createAsyncComponent({
228-
resolve: () => new Promise(resolve =>
229-
resolve(require('./components/Product'))
230-
)
231-
});
232-
233-
<AsyncProduct productId={1} />
234-
```
235-
236-
#### With Loading Component
217+
### Using Loading Components
237218

238219
```jsx
239220
const AsyncProduct = createAsyncComponent({
@@ -246,7 +227,7 @@ const AsyncProduct = createAsyncComponent({
246227
<AsyncProduct productId={1} />
247228
```
248229

249-
#### Webpack 1/2 `require.ensure` Code Splitting
230+
### Webpack 1/2 `require.ensure` Code Splitting
250231

251232
```jsx
252233
const AsyncProduct = createAsyncComponent({
@@ -260,7 +241,7 @@ const AsyncProduct = createAsyncComponent({
260241
<AsyncProduct productId={1} />
261242
```
262243

263-
#### Webpack 2 `import` / `System.import` Code Splitting
244+
### Webpack 2 `import` / `System.import` Code Splitting
264245

265246
Note: `System.import` is considered deprecated and will be replaced with `import`, but for now they can be used interchangeably (you may need a Babel plugin for the `import` syntax).
266247

@@ -272,7 +253,7 @@ const AsyncProduct = createAsyncComponent({
272253
<AsyncProduct productId={1} />
273254
```
274255

275-
#### Defer Loading to the Client/Browser
256+
### Defer Loading to the Client/Browser
276257

277258
i.e. The component won't be resolved and rendered in a server side rendering execution.
278259

0 commit comments

Comments
 (0)