如何处理 Typescript 中的 onChange

How to handle onChange in Typescript

我是 Typescript 的新手。使用 Typescript 语言时,您通常如何处理 TextField 中的 onChange


import React, { useState } from 'react';
import { useForm } from 'react-hook-form';
import { TextField } from '@material-ui/core';

const [date, setDate] = useState(
    new Date().getDate() + '/' + (new Date().getMonth() + 1) + '/' + new Date().getFullYear(),
);

const handleChangeDate = (e: React.ChangeEvent<any>): void => {
    setDate(e.target.value);
};

对于 MUI 文本字段

event: React.ChangeEvent<HTMLInputElement>