Datepicker for React-Strap

Viewed 18047

I am using react-strap npm package to use Bootstrap 4 components in my React app.

When I try to add the datepicker react-bootstrap-date-picker

npm install --save react-bootstrap-date-picker

then try to use it in my component:

var DatePicker = require("react-bootstrap-date-picker");

I get the error

Error in ./~/react-bootstrap-date-picker/lib/index.js

Module not found: 'react-bootstrap/lib/Button' in C:\Users\y\Desktop\Code\test\node_modules\react-bootstrap-date-picker\lib

@ ./~/react-bootstrap-date-picker/lib/index.js 15:14-51

Is this because react-bootstrap-date-picker is not compatible with react-strap? In this case, which npm packages should I install for bootstrap 4 components so that the datepicker module can work?

2 Answers

react-bootstrap-date-picker is using react-bootstrap, react-bootstrap depends on bootstrap3. reactstrap is for bootstrap4 That is why it doesnt work.

You can use react-widgets DateTimePicker instead.

You have now available reactstrap-date-picker, which is heavily based on react-bootstrap-date-picker, but ready for the reactstrap world.

Disclaimer: I'm the author of the library.

Although still in first 0.* versions, I'm using it successfully on my projects and, as soon as I receive feedback enough, it'll be 1.0 and considered production-ready.

Related