【发布时间】:2017-09-02 11:00:27
【问题描述】:
我有以下代码:
<MenuItem primaryText="home" containerElement={<Link to="/" />} />
但它不能像这里Material UI Menu using routes 讨论的 MenuItem 的其他主题/线程中解释的那样工作。 一旦我将 containerElement 道具添加到 MenuItem 我得到这个异常:
Uncaught 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.
Check the render method of `EnhancedButton`.
【问题讨论】:
-
如何导入您的
Link? -
这是导入
import Link from 'react-router'; -
不确定这是主要问题,但应该是
import { Link } from 'react-router';
标签: reactjs react-router material-ui