Property 'value' does not exist on type EventTarget in TypeScript

后端 未结 8 1061
野趣味
野趣味 2020-11-29 17:06

So the following code is in Angular 4 and I can\'t figure out why it doesn\'t work the way as expected.

Here is a snippet of my handler:

onUpdatingSe         


        
8条回答
  •  日久生厌
    2020-11-29 17:39

    You should use event.target.value prop with onChange handler if not you could see :

    index.js:1437 Warning: Failed prop type: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
    

    Or If you want to use other handler than onChange, use event.currentTarget.value

提交回复
热议问题