I have a setState function in React that I would like to pass in to another function as a parameter. I was wondering how I can define this in TypeScript without using the "any" as the type:
So far it looks like this:
export const keyDownHandler = (
event: React.KeyboardEvent,
buttonDate: number,
setShowCalendar: any
): void => {
// stuff happening
setShowCalendar(false);
};

Function?type ShowCalendar= (boolen) => void export const keyDownHandler = (event: React.KeyboardEvent, buttonDate: number, setShowCalendar: ShowCalendar): void => { // stuff happening setShowCalendar(false) }