Skip to content

arnaldobatista/react-native-fast-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fast.com logo

React native fast.com API

A speed test using Fast.com for React Native. Axios is used to make the requests.

Installation

$ npm install --save react-native-fast-api

Api usage

Example:

import ApiSpeed from "react-native-fast-api";
import React, { useState, useEffect } from "react";
import { View, Text } from "react-native";

const App = () => {
  const [resultTest, setResultTest] = useState("");
  const [statusTest, setStatusTest] = useState(true);

  useEffect(() => {
    calculateDownloadSpeed();
  }, []);

  const calculateDownloadSpeed = () => {
    ApiSpeed.calculateSpeed()
      .then((downloadSpeed) => {
        setResultTest(downloadSpeed);
        setStatusTest(false);
        console.log(downloadSpeed);
      })
      .catch((error) => {
        console.error("Erro ao calcular a velocidade de download", error);
      });
  };

  return (
    <View>
      <Text>Resultado do teste: {resultTest}</Text>
      <Text>Status do teste: {statusTest ? "Em andamento" : "Concluído"}</Text>
    </View>
  );
};

export default App;

Donate Paypall: arnaldo.carpi@icloud.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published