Benjamin Li Benjamin Li - 1 month ago 11
React JSX Question

react with redux, event handler name

I am looking at this source code.

render() {
const { value, onChange, options } = this.props

return (
<span>
<h1>{value}</h1>
<select onChange={e => onChange(e.target.value)}
value={value}>
{options.map(option =>
<option value={option} key={option}>
{option}
</option>)
}
</select>
</span>
)
}


my question is, why the event handler is
onChange
? I think the standard html attribute is
onchange
. and unfortunately, I cannot find any react document about the event handler names

thanks

Dez Dez
Answer

Event is defined as onChange in ReactJS: https://facebook.github.io/react/docs/events.html

You have some examples of use in ReactJS documentation website: https://facebook.github.io/react/docs/forms.html

Comments