Skip to content

Instantly share code, notes, and snippets.

View visoft's full-sized avatar

Damien White visoft

View GitHub Profile
import { useState, useEffect, useCallback } from "react";
interface RequestProps<T> {
url: RequestInfo;
init?: RequestInit;
processData?: (data: any) => T;
}
export const useFetch = <T>({ url, init, processData }: RequestProps<T>) => {
// Response state