I’m getting attached error while running the code Chrome development tool
Here is the code
import { useState } from "react";
export function useLocalStorage (key, defaultValue){
const getInitialValue = () => localStorage.getItem(key) ?? defaultValue;
const [value,setValue] = useState(getInitialValue);
const SetAndStoreValue = (newvalue) => {
setValue(newvalue);
localStorage.setItem(key,newvalue);
}
return [value,SetAndStoreValue];
}