我的react项目中有一个导航栏,但是当页面宽度太小时用于扩展导航栏的按钮不起作用。我已遵循引导程序文档,但仍无法正常工作。我有没有图书馆吗?我正在尝试使用在这里找到的navBar: https://getbootstrap.com/docs/4.0/components/navbar/
我的navBar具有以下代码:
import React from "react";
import { Link, NavLink } from "react-router-dom";
const NavBar = ({ user }) => {
return (
<nav className="navbar navbar-expand-lg navbar-light bg-light">
<Link className="navbar-brand" to="/">
NavBar
</Link>
<button
className="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="navBar"
aria-controls="navBar"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span className="navbar-toggler-icon" />
</button>
<div className="collapse navbar-collapse" id="navBar">
<div className="navbar-nav">
<NavLink className="nav-item nav-link" to="/home">
Home
</NavLink>
<NavLink className="nav-item nav-link" to="/buildings">
Support
</NavLink>
</div>
</div>
</nav>
);
};
export default NavBar;
感谢任何帮助