我的反应应用程序曾经使用react-bootstrap,现在突然导航无效。这是我的package.json。目前,它只显示“室友”品牌,但没有其他项目,如登录或联系或关于它旁边有一个小按钮,当我点击按钮,它扩展一秒钟,菜单显示和再次消失,当屏幕很小时,汉堡包菜单也不显示。
{
"name": "newreactstuff",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-bootstrap": "^0.32.1",
"react-dom": "^16.2.0",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:3001/"
}
这是我的导航组件
import React, { Component } from 'react';
import {
Link
} from 'react-router-dom';
import { NavItem } from 'react-bootstrap';
import { MenuItem } from 'react-bootstrap';
import { NavDropdown } from 'react-bootstrap';
import { Nav, Navbar, NavItem, NavDropdown, MenuItem, FormControl, FormGroup,
Button } from 'react-bootstrap';
class Navigation extends Component {
render() {
return (
<Navbar inverse collapseOnSelect>
<Navbar.Header>
<Navbar.Brand>
<Link to="/">Roommates</Link>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
<Nav pullRight>
<li><Link to="/">Sign In</Link></li>
<li><Link to="/contact">Contact</Link></li>
<li><Link to="/about">About</Link></li>
</Nav>
</Navbar.Collapse>
</Navbar>
)
}
}
export default Navigation;