1.0.13 • Published 3 years ago

use-fetching v1.0.13

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

use-fetching

Whis hook was developed to work with fetch api in the react functional way, even if you have a context.

Installation

from npm

npm install use-fetching

or

yarn add use-fetching

Usage

function MyComponent(){

     const { 
            loading,    // Boolean to control loading instate in your component.
            response,   // Fetch response object json.
            error,      // Fetch error object.
            call        // Function to call(url, options = {}) that gonna call "fetch(url, options)".
            } = useFetch()
    

    useEffect(()=>{
        console.log( response )
    }, [response])

    useEffect(()=>{
        call(
            'https://viacep.com.br/ws/20231006/json/unicode/',
            options // Not mandatory.
            )
    }, [])

    // Continue your code...    
}
1.0.11

3 years ago

1.0.13

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago