React Fetch
Install
npm install react-fetch
Props
url
: where to fetch json data fromonSuccess
: function on successfully fetching the dataonError
: function to be called on erroroptions
: object containing parameters for the request (see the fetch spec)
Example
pass an api endpoint and the resulting object will be passed as a prop.
Component { return <Fetch url="http://api.openweathermap.org/data/2.5/weather?q=London,uk"> <TestComponent/> </Fetch> } Component { console return <div/> }React;
Rebuilding
Run this to view the example in example/dist
npm run build