I am a newbie to recatjs.I have a requirement to create a input field with datetimepicker using boostrap,as I am using boostrap datetimepicker cdn link and I don't know how to call inside component and get the values of datetimepicker in componentdidmount method. Kindly provide me with a solution.
i can help you with react date-picker it is so easy in install and usage
you can install it by this command
npm i --save react-datepicker
npm i --save moment
and this is my code i tried it and use it always, and with saving date value in handleChange function as the follow code
import React, { Component } from 'react'
import DatePicker from 'react-datepicker';
import moment from 'moment';
class About extends Component {
constructor (props) {
super(props)
this.state = {
startDate: moment()
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(date) {
this.setState({
startDate: date
});
}
render() {
return (
<div >
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
peekNextMonth
showMonthDropdown
showYearDropdown
dropdownMode="select"
/>
</div>
)
}
}
export default About
for more information follow this link https://github.com/Hacker0x01/react-datepicker