react-native-fetch-http

0.0.2 • Public • Published

介绍

在fetch基础上封装一层,可以设置timeout,支持get,post请求

安装

npm install react-native-fetch-http

用法

import { AppRegistry, View } from "react-native";
import React, { Component } from "react";
import Http from "react-native-fetch-http";

export default class Index extends Component {
  componentDidMount() {
    var http = new Http(50000); //50000ms
    http
      .get("http://api.m.panda.tv/ajax_get_live_list_by_multicate", {
        hotroom: 1,
        __plat: "h5"
      })
      .then(content => {
        alert(content.errno);
      });
  }

  render() {
    return <View />;
  }
}

AppRegistry.registerComponent("Test", () => Index);

Readme

Keywords

Package Sidebar

Install

npm i react-native-fetch-http

Weekly Downloads

8

Version

0.0.2

License

ISC

Last publish

Collaborators

  • zhangxiaohu