React Select Onchange Event Target Undefined

Related Post:

React Select Onchange Event Target Undefined - Acknowledge and honor achievements with our React Select Onchange Event Target Undefined. Inspire and inspire with personalized certificates.

It is because onChange generates an Event, and you access the value by event.target.value ... event: target: value: "string" On the other hand, when you use the function like in onChange= setInsertedTitle, it receives the event. You can see it here: https://codesandbox.io/s/compassionate-fast-krrib?file=/src/App.js Share Follow Why this works: OPTION #1 function changeSelect (event) const newValue = event.target.value; setNestedState ( (prevState) => return ( ...prevState, propA: newValue ); ); And this doesn't? (it works only on the first change) OPTION #2

React Select Onchange Event Target Undefined

React Select Onchange Event Target Undefined

React Select Onchange Event Target Undefined

The problem came from using semantic-ui-react with redux-form.The in redux-form will provides an onChange() callback in props, which expect the first argument to be React SyntheticEvent, or the value of the field.. Currently, I just wrap the or in another component, which provides a handleChange(event, data) function, which will call this.props.onChange(data ... API Reference Components component lets you render a select box with options. Reference