You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the latter code handles that promise declaratively instead of imperatively.
39
39
In case you need user input before you can make the async call, there is a `before` property. Assign a function into it if you need to render a form for example.
40
40
```javascript
41
41
<Async before={(handlePromise) => {
@@ -50,16 +50,12 @@ In case you need user input before you can make the async call, there is a `befo
50
50
```
51
51
The form is rendered before the promise is resolved. If you ever need to reset the Async to `before` after promise has resolved/rejected get the Async ref and use
52
52
```javascript
53
-
ref.setState({started:false})
53
+
ref.setState({status:'none'})
54
54
```
55
55
56
56
## install
57
57
58
-
With jspm:
59
-
```
60
-
jspm i npm:react-promise
61
-
```
62
-
or with npm:
58
+
With npm:
63
59
```
64
60
npm i react-promise
65
61
```
@@ -71,11 +67,11 @@ All props are optional
71
67
- **before** if no promise is provided, Async will invoke this inside it's render method-use for forms and such
72
68
- **then** runs when promise is resolved. Async will run function provided in it's render passing a resolved value as first parameter.
73
69
- **catch** runs when promise is rejected. Async will run function provided in it's render passing an error as first parameter.
74
-
- **pendingRender** is a node which will be outputted from Async render method while promise is pending. If none is provided, defaults to `<div/>`
70
+
- **pending** is a React node which will be outputted from Async render method while promise is pending. If none is provided, defaults to `<div/>`
0 commit comments