Skip to content

Commit dc885b2

Browse files
committed
added showcase, pendingRender propr renamed to "pending"
bumped to 2.0.0
1 parent 7c4b976 commit dc885b2

File tree

9 files changed

+3024
-1376
lines changed

9 files changed

+3024
-1376
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const ExampleWithAsync = (props) => <Async promise={prom} then={(val) => <div>{v
3535
```
3636
3737
Much simpler, right?
38-
38+
Because the latter code handles that promise declaratively instead of imperatively.
3939
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.
4040
```javascript
4141
<Async before={(handlePromise) => {
@@ -50,16 +50,12 @@ In case you need user input before you can make the async call, there is a `befo
5050
```
5151
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
5252
```javascript
53-
ref.setState({started: false})
53+
ref.setState({status: 'none'})
5454
```
5555
5656
## install
5757
58-
With jspm:
59-
```
60-
jspm i npm:react-promise
61-
```
62-
or with npm:
58+
With npm:
6359
```
6460
npm i react-promise
6561
```
@@ -71,11 +67,11 @@ All props are optional
7167
- **before** if no promise is provided, Async will invoke this inside it's render method-use for forms and such
7268
- **then** runs when promise is resolved. Async will run function provided in it's render passing a resolved value as first parameter.
7369
- **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/>`
7571
7672
## To use with Typescript
7773
78-
```
74+
```typescript
7975
import Async, { Props as AsyncProps } from 'react-promise'
8076

8177
const StringAsync = Async as { new (props: AsyncProps<string>): Async<string> }

0 commit comments

Comments
 (0)