【发布时间】:2017-07-11 19:06:24
【问题描述】:
我正在使用react-router 进行导航。我有一些组件需要登录才能看到。
因此我有这个:(来自 react-router 中的以下文档)
<Route
{...rest}
render={props =>
isLoggedIn()
? <Component {...props} />
: <Redirect
to={{
pathname: '/login',
state: {from: props.location},
}}
/>}
/>
但是,这样做有一个问题,因为jsx-no-bind 不允许使用箭头功能。解决这个问题的正确方法是什么?还是应该简单地忽略这一点,因为它由于某种原因不会受到相同的性能影响?
【问题讨论】:
-
这方面有什么新的吗?
标签: react-router react-jsx jsx