I created the following useToggle hook which does not make use of .map()
:
import { useState } from "react";
export const useToggle = (
initialValue: boolean = false
): [boolean, () => void] => {
const [value, setValue] = useState(initialValue);
const toggleValue = () => setValue((prevVal) => !prevVal);
return [value, toggleValue];
};
The TS compiler gives me the following error:
./src/Components/util/hooks/useToggle.ts
Line 0: Parsing error: Cannot read property 'map' of undefined
I've searched for the word map in the file like 10 times, but it's not there. Someone please reassure me I'm not going insane!