我正在开始学习 React 并尝试从 React-bootstrap 创建一个 Jumbotron 元素。我很确定我已经安装了所有正确的模块npm install react-bootstrap bootstrap,但我收到一个控制台错误,显示“尝试导入错误:'Jumbotron 未从'react-bootstrap'导出(导入为'Jumbo')”。我的代码如下:
import React from 'react';
import { Jumbotron as Jumbo, Container } from 'react-bootstrap';
import styled from 'styled-components';
import boatImage from '../assets/boatImage.jpg';
const Styles = styled.div `
.jumbo {
background: url(${boatImage}) no-repeat fixed bottom;
background-size: cover;
color: #efefef;
height: 200px;
position: relative;
z-index: -2;
}
.overlay {
background-color: #000;
opacity: 0.6;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: -1;
}
`;
export const Jumbotron …Run Code Online (Sandbox Code Playgroud)