Reputation: 451
I currently have
<input type="date" onChange={(input) => { _this.setState({startDate: input})}}/>
No matter what I've been changing around (the onChange part to ref etc etc), startDate shows up as undefined when I console.log my state. I've even changed startDate:input
to startDate:input.value
and it still hasn't worked.
I tried using many react libraries such as react-datepicker and etc. So far they haven't really been working out for me(We have a ton of CSS and their CSS is messed up due to that issue).
Upvotes: 3
Views: 15264
Reputation: 5797
Not sure what _this
is.
I'd recommend checking out the MDN reference on input
events to get an idea of what they are / how to intercept them.
See below for a working example.
<input type="date" onChange={(event) => this.setState({startDate: event.target.value})}/>
Upvotes: 8