React Bootstrap Modal无法弹出问题求助(v1.0.0-beta.16)
Hey there! I’ve run into this exact snag before—let’s get that modal working for you.
The core issue here is that you’re missing the Bootstrap CSS file in your project. React Bootstrap only provides React component logic, not the actual Bootstrap styles. Without the CSS, your modal is technically rendering, but it’s hidden (and unstyled) so you can’t see it at all.
Here’s how to fix it step by step:
Install Bootstrap CSS (match your React Bootstrap version)
Since you’re using React Bootstrap 1.0.0-beta.16, you need Bootstrap 4.x (this version of React Bootstrap is built for Bootstrap 4). Run this command in your project folder:npm install bootstrap@4.5.0Import the CSS into your project
Add this line to the top of yourindex.jsfile (orApp.jsif you prefer):import 'bootstrap/dist/css/bootstrap.min.css';If you’d rather use a CDN, add this link tag to the
<head>section of yourpublic/index.htmlfile:<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" crossorigin="anonymous">
Quick check:
Your existing component code is totally correct—you’re passing the show state and onHide handler properly to your custom modal. Once you add the Bootstrap CSS, clicking that button should pop up your centered modal exactly like you expected!
内容的提问来源于stack exchange,提问作者Kenny Smith

