Skip to content
Advertisement

Uncaught TypeError: event.target is undefined

Using React and React-Dropdown package, I keep getting this Uncaught TypeError: event.target is undefined error whenever I select a year.

JavaScript

Advertisement

Answer

Looks like this package doesn’t pass in the event but only the changed value of the new selected option:

https://github.com/fraserxu/react-dropdown/blob/master/index.js#L96-L100

So you will have to change your code to something like this:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement