react-numeric-input icon indicating copy to clipboard operation
react-numeric-input copied to clipboard

target.name is undefined

Open tomasherrera opened this issue 6 years ago • 2 comments

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.

tomasherrera avatar Mar 20 '18 20:03 tomasherrera

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

orlavy-bigabid avatar May 01 '18 13:05 orlavy-bigabid

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.

Mahezerlabs avatar May 16 '18 18:05 Mahezerlabs