react-accio
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -452,2 +452,11 @@ 'use strict'; | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate(prevProps) { | ||
var fetchKey = this.props.fetchKey; | ||
if (fetchKey && fetchKey(this.props) !== fetchKey(prevProps)) { | ||
this.doWork.call(this); | ||
} | ||
} | ||
}, { | ||
key: 'doWork', | ||
@@ -454,0 +463,0 @@ value: function () { |
@@ -446,2 +446,11 @@ import _regeneratorRuntime from 'babel-runtime/regenerator'; | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate(prevProps) { | ||
var fetchKey = this.props.fetchKey; | ||
if (fetchKey && fetchKey(this.props) !== fetchKey(prevProps)) { | ||
this.doWork.call(this); | ||
} | ||
} | ||
}, { | ||
key: 'doWork', | ||
@@ -448,0 +457,0 @@ value: function () { |
{ | ||
"name": "react-accio", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Declaratively fetch multiple APIs with a single React component.", | ||
@@ -5,0 +5,0 @@ "main": "dist/Accio.cjs.js", |
@@ -115,2 +115,17 @@ # Accio | ||
### Using fetchKey prop | ||
Use fetchKey prop if you want to re-trigger fetch based on your props. | ||
This example will trigger fetch when prop `url` change: | ||
```jsx | ||
function fetchKey(props) { | ||
return props.url; | ||
} | ||
<Accio url="https://api.example.com/data" fetchKey={fetchKey}> | ||
{renderData} | ||
</Accio> | ||
``` | ||
### Using render prop | ||
@@ -117,0 +132,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48167
1110
299