【问题标题】:what kind of event type is the event on the onInputChange props?onInputChange 道具上的事件是什么样的事件类型?
【发布时间】:2022-12-17 11:45:44
【问题描述】:

我正在尝试在 mui v4 自动完成组件上使用 React.ChangeEvent,因为我不想使用任何组件。 它如何抛出当前事件不兼容的错误。

  const handle = (e: React.ChangeEvent<HTMLTextAreaElement>, currentValue: string, reason: string) => {
  console.log(e,currentValue,reason)
  }

<Autocomplete onInputChange={handle}/>

【问题讨论】:

  • “它抛出当前事件不兼容的错误。”该错误应该告诉您当前的类型不兼容。

标签: reactjs typescript material-ui


【解决方案1】:

签名:

function(event: object, value: string, reason: string) =&gt; void
事件:回调的事件源。
价值:文本输入的新值。
原因:可以是:"input"(用户输入)、"reset"(程序更改)、"clear"

MUI documentation for Autocomplete API

【讨论】:

    猜你喜欢
    • 2020-11-26
    • 2016-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-24
    • 1970-01-01
    • 2019-08-04
    • 1970-01-01
    相关资源
    最近更新 更多