背景:
你好,我是新的反应开发和目前开发使用材料用户界面的web应用程序,我想显示错误和成功的消息,我想使用"mdbalert“从mdbreact。(我知道零食吧,但我觉得它令人困惑)
问题:
如何只安装mdbalert而不是安装整个mdbreact包。
任何建议或暗示都会有帮助。提前谢谢。
发布于 2019-04-02 12:37:45
据我所知,你会安装整个软件包。然后,根据需要只导入mdbreact。
要只需要mbreact组件的一部分,您可以这样做:
import React from "react"; // import react and other modules
import { MDBContainer, MDBAlert } from 'mdbreact'; // import MDBAlert and other components of mbreact谈到生产模式,Webpack应该只编译已经导入的代码(在本例中是MDBAlert),而不是编译整个mbreact模块。
https://stackoverflow.com/questions/55474667
复制相似问题