Я следую этому уроку: https://serverless -stack.com / chapters / create-container.html и у меня возникла проблема с Navbar.
Вот мой код дляApp.js:
import React, { Component } from "react";
import { Link } from "react-router-dom";
import { Navbar } from "react-bootstrap";
import Routes from "./Routes";
import "./App.css";
export default class App extends Component {
render() {
return (
<div className="App container">
<Navbar fluid collapseOnSelect>
<Navbar.Header>
<Navbar.Brand>
<Link to="/">Scratch</Link>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
</Navbar>
<Routes />
</div>
);
}
}
Routes.js:
import React from "react";
import { Route, Switch } from "react-router-dom";
import Home from "./containers/Home";
export default () =>
<Switch>
<Route path="/" exact component={Home} />
</Switch>;
Он успешно скомпилирован, но у меня есть эта ошибка:
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.
Check the render method of `App`.
Я заметил, что если я удалючасть Navbar.Header и оставить только Navbar он работает.
Есть идеи?