Skip to content

Commit c775d21

Browse files
committed
now requires promise in props
1 parent 373289a commit c775d21

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,20 @@ const ExampleWithAsync = (props) => <Async promise={prom} then={(val) => {return
3636
3737
Much simpler, especially if your component is read-only, like the example.
3838
39+
## install
40+
41+
With jspm:
42+
```
43+
jspm i npm:react-async
44+
```
45+
or with npm:
46+
```
47+
npm i react-async
48+
```
49+
3950
## [Available props](https://github.com/capaj/react-async/blob/master/async.js#L48):
4051
41-
- *promise* a promise you want to wait for
42-
- *then* runs when promise is resolved. Async will run function provided in it's render passing a resolved value as first parameter.
43-
- *catch* runs when promise is rejected. Async will run function provided in it's render passing an error as first parameter.
44-
- *pendingRender*(optional) is a node which will be outputted from Async render method while promise is pending. If none is provided, defaults to `<div/>`
52+
- **promise** a promise you want to wait for
53+
- **then**(optional) runs when promise is resolved. Async will run function provided in it's render passing a resolved value as first parameter.
54+
- **catch**(optional) runs when promise is rejected. Async will run function provided in it's render passing an error as first parameter.
55+
- **pendingRender**(optional) is a node which will be outputted from Async render method while promise is pending. If none is provided, defaults to `<div/>`

async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Async.propTypes = {
4949
then: PropTypes.func,
5050
catch: PropTypes.func,
5151
pendingRender: PropTypes.node,
52-
promise: PropTypes.object
52+
promise: PropTypes.object.isRequired
5353
}
5454

5555
export default Async

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-async",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "react.js component",
55
"main": "async.js",
66
"scripts": {

0 commit comments

Comments
 (0)