尝试导入错误:“ Toast”未从“ react-bootstrap”导出

时间:2020-04-22 16:23:43

标签: 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

2 个答案:

答案 0 :(得分:1)

在发布任何问题之前,请先阅读文档。访问OP2

更改

从'react-bootstrap'导入{Toast};

使用

从'react-bootstrap / Toast'导入Toast

答案 1 :(得分:0)

将导入更改为 从'react-bootstrap / Toast'导入{Toast}