In my react and typescript app, I use: onChange={(e) => data.motto = (e.target as any).value}
.
How do I correctly define the typings for the class, s
When using Child Component We check type like this.
Parent Component:
export default () => {
const onChangeHandler = ((e: React.ChangeEvent): void => {
console.log(e.currentTarget.value)
}
return (
);
}
Child Component:
type Props = {
onChange: (e: React.ChangeEvent) => void
}
export Input:React.FC ({onChange}) => (
)