错误:元素类型无效,请检查渲染方法

时间:2020-08-31 18:32:54

标签: reactjs react-router jsx

我正在学习React,整理我的导航栏时遇到了一些麻烦。

我有此错误:

public void handle(ActionEvent event) {
    PauseTransition delay = new PauseTransition(Duration.minutes(30));
    delay.setOnFinished(evt -> {
        // whatever you need to do in 30 minutes....
    });
    delay.play();
}

检查Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. 的呈现方法。

在线查看表明,大多数情况下,这是命名约定的问题。但对于我的一生,我看不到任何错误。

这是我的文件:

导航

navigation

布局

import './Navigation.css';
import { Col, Navbar, Nav, NavItem } from 'react-bootstrap';
import { NavLink } from 'react-router-dom';
import { LinkContainer } from 'react-router-bootstrap';

const navigation = (props) => {
    return (
        <Col md={12} >
            <Navbar inverse collapseOnSelect>
                <Navbar.Header>
                    <Navbar.Brand>
                        <NavLink to={'/'} exact >Account-Owner</NavLink>
                    </Navbar.Brand>
                    <Navbar.Toggle />
                </Navbar.Header>
                <Navbar.Collapse>
                    <Nav>
                        <LinkContainer to={'/owner-list'} exact>
                            <NavItem eventKey={1}>
                                Owner Actions
                            </NavItem>
                        </LinkContainer>
                        <LinkContainer to={'/account-list'}>
                            <NavItem eventKey={2}>
                                Account Actions
                            </NavItem>
                        </LinkContainer>
                    </Nav>
                </Navbar.Collapse>
            </Navbar>
        </Col>
    )
}

export default navigation;

app.js

import { Container as Container, Row } from 'react-bootstrap';
import Navigation from '../Navigation/Navigation';

const layout = (props) => {
    return (
        <Container>
            <Row>
                <Navigation/>
            </Row>
            <main>
                {props.children}
            </main>
        </Container>
    )
}

export default layout;

0 个答案:

没有答案