I'm new to TypeScript and I want to pass my function onDogSelected to the children component <Dogs />.
When I tried, I got some error message like this:
Type '{ onDogSelected: (e: any) => void; }' is not assignable to type 'IntrinsicAttributes & { children?: ReactNode; }'.Property 'onDogSelected' does not exist on type 'IntrinsicAttributes & { children?: ReactNode; }'.
I don't know what this means. I was trying to figure it out but still have no solution.
const HomePage: React.FC = () => {
const [dogSelected, setDogSelected] = useState("");
const onDogSelected = (e: any) => {
setDogSelected(e.target.value)
}
return (
<ApolloProvider client={client2}>
<Dogs onDogSelected={onDogSelected} />
{dogSelected && <span>{dogSelected}</span>}
</ApolloProvider>
);
};
export default HomePage;