React Bootstrap元素类型无效

时间:2019-01-23 00:11:11

标签: javascript reactjs navbar react-bootstrap

我正在尝试实现react-bootstrap提供的导航栏组件。但是我收到一个奇怪的错误。下面是stacktrace的屏幕截图。 enter image description here

这是我的导航栏代码。

import React from "react";
import {Navbar, Nav, NavItem} from "react-bootstrap";
import navigationbarlogo from "../assets/images/navigationbarlogo.png"
import navstyle from "../assets/css/NavigationBar.css"

class NavigationBar extends React.Component{
    render() {
        return (
                <Navbar bsStyle="inverse">
                    <Navbar.Header>
                        <Navbar.Brand style={navstyle}>
                            <img src={navigationbarlogo} alt={'logo for navigation bar'}/>
                            <a href="http://localhost:3000">Tweelyze</a>
                        </Navbar.Brand>
                    </Navbar.Header>
                    <Nav>
                        <NavItem eventKey={1} href="#">Analytics</NavItem>
                        <NavItem eventKey={2} href="#">About Us</NavItem>
                    </Nav>
                </Navbar>
        );
    }
}

export default NavigationBar;

我无法弄清楚这里出了什么问题

2 个答案:

答案 0 :(得分:0)

检查您导入的组件。我们使用import Infil_Data2 <- structure(list(Time = c(0L, 30L, 60L, 90L, 120L, 150L, 180L, 210L, 240L, 270L, 300L, 0L, 30L, 60L, 90L, 120L, 150L, 180L, 210L, 240L, 270L, 300L, 0L, 30L, 60L, 90L, 120L, 150L, 180L, 210L, 240L, 270L, 300L), Site_ID = c("H1", "H1", "H1", "H1", "H1", "H1", "H1", "H1", "H1", "H1", "H1", "H2", "H2", "H2", "H2", "H2", "H2", "H2", "H2", "H2", "H2", "H2", "H3", "H3", "H3", "H3", "H3", "H3", "H3", "H3", "H3", "H3", "H3"), Vol_mL = c(63, 62, 60, 59, 58, 56, 54, 52.5, 50, 48.5, 46.5, 82, 77, 73, 68, 65, 51, 56, 52, 47.5, 42.5, 37.5, 69, 67, 65, 63, 61, 60, 58, 56, 54, 51.5, 49), Sqrt_Time.x = c(0, 5.477225575, 7.745966692, 9.486832981, 10.95445115, 12.24744871, 13.41640786, 14.49137675, 15.49193338, 16.43167673, 17.32050808, 0, 5.477225575, 7.745966692, 9.486832981, 10.95445115, 12.24744871, 13.41640786, 14.49137675, 15.49193338, 16.43167673, 17.32050808, 0, 5.477225575, 7.745966692, 9.486832981, 10.95445115, 12.24744871, 13.41640786, 14.49137675, 15.49193338, 16.43167673, 17.32050808), Cal_Vol_cm = c(0, 0.124339799, 0.373019398, 0.497359197, 0.621698996, 0.870378595, 1.119058194, 1.305567893, 1.616417391, 1.80292709, 2.051606688, 0, 0.621698996, 1.119058194, 1.74075719, 2.113776588, 3.854533778, 3.232834782, 3.730193979, 4.289723076, 4.911422072, 5.533121068, 0, 0.248679599, 0.497359197, 0.746038796, 0.994718394, 1.119058194, 1.367737792, 1.616417391, 1.865096989, 2.175946488, 2.486795986)), row.names = c(NA, 33L ), class = "data.frame") 导入命名的export和{component-name} from ''导入默认的导入。

答案 1 :(得分:0)

我认为这是导入样式的方式,当找不到导入的模块时,通常会发生此错误。我可以查看您文件的目录,以便我们检查文件是否正确加载到该目录吗?