Skip to content

Instantly share code, notes, and snippets.

View Hawaii66's full-sized avatar
🎯
Focusing

Sebastian Ahlman Hawaii66

🎯
Focusing
View GitHub Profile
@Hawaii66
Hawaii66 / useEnv.ts
Created July 6, 2022 19:45
useEnv() | Custom Hook | React
import { useEffect, useState } from "react";
export enum EnvVariable {
enviorment,
serverEndPoint,
website
}
type EnvVariables = {[key in keyof typeof EnvVariable]:string}
import { useCallback, useEffect, useState } from "react";
interface BaseProps{
path:string,
start:boolean
}
type GetProps = {
method:"GET"|"HEAD",
data?:never