showing results for - "localstorage in next js"
Vihan
27 Sep 2020
1import { FunctionComponent, createElement, useState, MouseEvent, useEffect } from 'react'
2
3interface Props {
4    type: string 
5}
6
7const CleanupLocalStorage: FunctionComponent<Props> = (props: Props) => {
8
9  const LocalStorage = ({ type }): void => {
10    switch (type) {
11        case 'clear':
12            type !== undefined && window.localStorage.clear()
13            break
14        default:
15            alert('localStorage type undefined')
16            break
17    }
18}
19
20useEffect(() => {
21    LocalStorage(props)
22},[])
23
24 
25    return <></>
26}
27 
28export default CleanupLocalStorage