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.
2121- Accepts ` onResolved ` and ` onRejected ` callbacks
2222- Supports optimistic updates using ` setData `
2323
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-
2724## Rationale
2825
2926` <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
3532data on-demand and in parallel at component level instead of in bulk at the route / page level. It's entirely decoupled
3633from your routes, so it works well in complex applications that have a dynamic routing model or don't use routes at all.
3734
35+ ## Install
36+
37+ ```
38+ npm install --save react-async
39+ ```
40+
3841## Usage
3942
4043Using render props for ultimate flexibility:
4144
4245``` js
46+ import Async from " react-async"
47+
4348const loadJson = () => fetch (" /some/url" ).then (res => res .json ())
4449
4550const MyComponent = () => {
@@ -65,6 +70,8 @@ const MyComponent = () => {
6570Using helper components (don't have to be direct children) for ease of use:
6671
6772``` js
73+ import Async from " react-async"
74+
6875const loadJson = () => fetch (" /some/url" ).then (res => res .json ())
6976
7077const MyComponent = () => {
You can’t perform that action at this time.
0 commit comments