react-native-fetch
Fetch API wrapped as a component with support for retries & timeouts
Table of Contents
Install
This project uses node and npm.
$ npm install react-native-fetch$ # OR $ yarn add react-native-fetch
Usage
{ return <View style=stylescontainer> <Fetch url="https://jsonplaceholder.typicode.com/posts/1" retries=3 timeout=3000 onResponse=async { const json = await res console } onError=consoleerror /> </View> }
Properties
url
(String) - The request url. Required.onResponse
(Function) - Fired when response is received.onError
(Function) - Fired when error occurs during request.method
(String) - HTTP request method. Default: 'GET'body
(String, body types) - HTTP request body.headers
(Object, Headers)- HTTP request headers to send. Default: {}
See tenacious-fetch for more information about supported props.
Contribute
- Fork it and create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request
License
MIT