skip to Main Content

How to check passed type in Typescript? – Reactjs

If T is string | undefined, no json parsing need, but return the string itself. How can I implement it? import { useEffect, useState, Dispatch, SetStateAction } from 'react' type SetValue<T> = Dispatch<SetStateAction<T>> export default function useLocalStorage<T>( key: string, fallbackValue:…

VIEW QUESTION
Back To Top
Search