Skip to content

Instantly share code, notes, and snippets.

View wkei's full-sized avatar
📷
"click"

Kei wkei

📷
"click"
View GitHub Profile
import { useState, useEffect } from 'react'
import axios, { CancelToken } from 'axios'
export default function useFetch (options) {
const [data, setData] = useState(null)
const [isLoading, setIsLoading] = useState(false)
const [error, setError] = useState(null)
useEffect(_ => {
const source = CancelToken.source();