我的 scalajs-react 应用程序有以下代码:
def render(person: Person) = {
<.div(
<.p("Welcome!"),
<.form(
<.label("Name:",
<.input(^.`type` := "text", ^.cls := "form-control",
^.value := person.name, ^.onChange ==> updatePersonName
)
))
)
}
def updatePersonName(event: ReactEventFromInput): Callback = {
$.modState(person => person.copy(name = event.target.value))
}
但我看到错误:
Uncaught TypeError: Cannot read properties of null (reading 'value')
我在这里想念什么?