Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-fetch

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-fetch

Fetch API wrapped as a component with support for retries & timeouts

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
decreased by-18.18%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-fetch

package version package downloads standard-readme compliant package license make a pull request Standard Travis Dependency CI Greenkeeper badge

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

import Fetch from 'react-native-fetch'

export default class Home extends Component {

 render () {
    return (
      <View style={styles.container}>
        <Fetch
          url="https://jsonplaceholder.typicode.com/posts/1"
          retries={3}
          timeout={3000}
          onResponse={async (res) => {
            const json = await res.json()
            console.log(json)
          }}
          onError={console.error}
        />
      </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

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am 'Add some feature'
  3. Push to the branch: git push origin my-new-feature
  4. Submit a pull request

License

MIT

Keywords

FAQs

Package last updated on 30 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc