最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Datepicker for React-Strap - Stack Overflow

programmeradmin0浏览0评论

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?

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?

Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Nov 13, 2017 at 18:56 NyxynyxNyxynyx 63.6k163 gold badges506 silver badges855 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 9

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.

发布评论

评论列表(0)

  1. 暂无评论