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 @@ -21,9 +21,6 @@ assumptions about the shape of your data or the type of request.
21
21
- Accepts ` onResolved ` and ` onRejected ` callbacks
22
22
- Supports optimistic updates using ` setData `
23
23
24
- > This package is a work-in-progress. It has not yet been published on npm and its API may change before it's released.
25
- > Feel free to provide feedback.
26
-
27
24
## Rationale
28
25
29
26
` <Async> ` is different in that it tries to resolve data as close as possible to where it will be used, while using a
@@ -35,11 +32,19 @@ configure any data fetching or updates on a higher (application global) level, u
35
32
data on-demand and in parallel at component level instead of in bulk at the route / page level. It's entirely decoupled
36
33
from your routes, so it works well in complex applications that have a dynamic routing model or don't use routes at all.
37
34
35
+ ## Install
36
+
37
+ ```
38
+ npm install --save react-async
39
+ ```
40
+
38
41
## Usage
39
42
40
43
Using render props for ultimate flexibility:
41
44
42
45
``` js
46
+ import Async from " react-async"
47
+
43
48
const loadJson = () => fetch (" /some/url" ).then (res => res .json ())
44
49
45
50
const MyComponent = () => {
@@ -65,6 +70,8 @@ const MyComponent = () => {
65
70
Using helper components (don't have to be direct children) for ease of use:
66
71
67
72
``` js
73
+ import Async from " react-async"
74
+
68
75
const loadJson = () => fetch (" /some/url" ).then (res => res .json ())
69
76
70
77
const MyComponent = () => {
You can’t perform that action at this time.
0 commit comments