简体   繁体   中英

Bootstrap-Native with React.js

Since I don't want to use Bootstrap jquery or reactstrap, I'm trying to implement bootstrap native in react, a plain javascript version of bootstrap, in React.

tried

pm install --save bootstrap.native

and loaded with

import 'bootstrap.native/dist/bootstrap-native-v4.js';

But it does not work, I tried with the CDN before the closing body tag in index.html

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap.native/2.0.27/bootstrap-native-v4.min.js"></script>

But functionalities like modals and dropdowns doesn't work, I have no error in the debug console.

This question is not a duplicate of another problem with bootstrap.native but it has the same result so my answer is:

The reason modals and other elements are not shown is that bootstrap.native uses the browser DOM, which is going to wreck havoc with React's virtual DOM. In short: It does not work at all!

Use react-bootstrap it is a complete rewrite of bootstrap.js (and also no jQuery)
From the developers:

React-Bootstrap replaces the Bootstrap JavaScript. Each component has been built from scratch as a true React component, without unneeded dependencies like jQuery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM