【发布时间】:2018-02-21 22:29:38
【问题描述】:
外部包含的组件和外部文件
class NavigationBarContainer extends React.PureComponent {
render = () => <NavigationBar extraBanner={<Banner
/>} {...this.props} />
}
在我的应用中
import NavigationBar from '../components/NavigationBar'
<NavigationBar
extraBanner />
好像没用
import NavigationBarContainer from '../components/NavigationBar'
<NavigationBarContainer {...this.props}>
下面出现错误似乎不起作用
**Invalid prop extraBanner of type boolean supplied to NavigationBar, expected a single ReactElement.**
【问题讨论】:
-
你没有在第一个文件“export class NavigationBarContainer”中导出你的类
-
extraBanner 道具在您的代码中没有返回任何内容,该道具的目的是什么?或者多解释一点来帮助你。
标签: reactjs ecmascript-6 jsx