javascript - 尝试导入错误: 'Toast' is not exported from 'react-bootstrap'

标签 javascript reactjs bootstrap-4 react-bootstrap

import React from 'react';
import { Toast } from 'react-bootstrap';

export function Confirmation({ toggle }) {
        return (
            <Toast onClose={() => toggle(false)}>
                <Toast.Header>
                        <strong className="mr-auto">Your Order Is In The Oven!</strong>
                        <small>just now</small>
            </Toast.Header>
            <Toast.Body>
                Your delicious pizza will be with you in 30 minutes!
            </Toast.Body>
            </Toast>
        );
}

enter image description here

最佳答案

在发布任何问题之前,请先阅读文档。访问https://react-bootstrap.github.io/components/toasts/

改变

import { Toast } from 'react-bootstrap';

import Toast from 'react-bootstrap/Toast'

关于javascript - 尝试导入错误: 'Toast' is not exported from 'react-bootstrap' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61370096/

相关文章:

javascript - 与javascript中的for循环输出混淆

javascript - REACT JavaScript 如何使用自定义类名?

reactjs - React-router-redux 推送操作不起作用

html - 无法查看列的内容

javascript - 使用 Proj4 外部 JS 文件进行 Dojo 构建

javascript - jQuery 获取#foo 的outerWidth()

html - 每行设置一张卡片 Bootstrap 4

html - 内部下拉菜单上的 Bootstrap 折叠动画

javascript - 带有对象的闭包

reactjs - Redux 状态正在更新,无需分派(dispatch)任何操作