为什么我在尝试在CSSTransitionGroup
react-router
组件上设置Link
时收到此错误:
invariant.js:44 Uncaught Error: link is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`. Check the render method of TransitionGroup.
我的代码是:
return (
<CSSTransitionGroup component='Link' transitionName='navBarLink' transitionEnterTimeout={300} transitionLeaveTimeout={500}>
<Link style={linkStyle} to={this.props.pageTo} onClick={this.setActiveState}>
{this.props.title}
</Link>
</CSSTransitionGroup>
)
答案 0 :(得分:0)
你导入链接了吗?如果是这样,为什么链接在引号
component='Link'
不应该
component=Link