fast_fetch_react

0.1.995 • Public • Published

FastFetch

Fast Fetch for Reactjs

Install

$ npm install fast_fetch_react

Usage

import FastFetch from "fast_fetch_react"

import React from "react";
 
function Categories() {

    const [loading, error, categories] = FastFetch("https://fakestoreapi.com/products/categories", null, 60 * 60 * 1000);//1H
    if (loading) return <p>Loading...</p>;
    if (error) return <p>Something went wrong...</p>;
    if (!categories)
        return '';
    return (
        <div className="App">
            <header className="App-header">
                <p>Categories:</p>
                <ul>
                    {categories ? categories.map(c => <li>{c}</li>) : ''}
                </ul>
            </header>
        </div>
    );
}

export default Categories;

Readme

Keywords

none

Package Sidebar

Install

npm i fast_fetch_react

Weekly Downloads

42

Version

0.1.995

License

none

Unpacked Size

7.47 kB

Total Files

7

Last publish

Collaborators

  • devorel