skip to Main Content

How to type the result from locallstorage? – Reactjs

There is this type: export const enum AuctionsView { tiles = 'tiles', list = 'list' } State: const [auctionsView, setAuctionsView] = useState>AuctionsView> (localStorage.getItem('auctionsView') as AuctionsView ?? AuctionsView.tiles) Set state: useEffect(() => { localStorage.setItem('auctionsView', auctionsView) }, [auctionsView]); How do I make…

VIEW QUESTION
Back To Top
Search