【问题标题】:React-Bootstrap not working for server-side render React App?React-Bootstrap 不适用于服务器端渲染 React App?
【发布时间】:2021-01-14 10:54:04
【问题描述】:

我跟着 this tutorial 做了一个服务器端渲染网络应用,但是当我尝试实现 React-Router 时,我收到以下错误

Error: 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.

我一直在寻找如何解决它,但我似乎找不到解决方案,任何可能的输入都会很棒。

谢谢

【问题讨论】:

    标签: node.js reactjs express webpack react-bootstrap


    【解决方案1】:

    原来问题出在导入中,必须按如下方式导入

    import Button from 'react-bootstrap/Button'
    import Form from 'react-bootstrap/Form'

    也只是加载到引导文件的标准

    【讨论】:

      猜你喜欢
      • 2019-08-05
      • 2023-03-28
      • 2018-01-30
      • 2023-03-07
      • 2020-03-21
      • 2020-06-29
      • 2019-10-05
      • 1970-01-01
      • 2022-07-22
      相关资源
      最近更新 更多