issue with passing hook to child typescript

Your Props type for Child is incorrect. React types the setIsActive as Dispatch, which is defined as:

type Dispatch<A> = (value: A) => void;

You’re missing the value argument from your type. This should be correct:

type Props = {
   isActive: boolean;
   setIsActive: (active: boolean) => void;
}
const Child = ({ isActive, setIsActive}: Props) {
   // rest of the component
} 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)