react-numeric-input
react-numeric-input copied to clipboard
target.name is undefined
When I tried accesing a prop with e.target
I get undefined
, example: If try getting the name property, with {e => this.handleInputChange(e)}
and then e.target.name == 'whatever'
, I get that target is undefined.
The onChange function signature in this library is indeed non-standard, you will need to adjusti t to your needs.
Take a look at the docs : https://github.com/vlad-ignatov/react-numeric-input#event-callbacks
The onChange is actually different from the default input. It can receive 3 parameters: valueAsNumber
, valueAsString
(which are rather self explanatory) and input
, which returns your HTML input. To get target.name
, you can use input.name
.