嗨我有一个要求,如果用户loggedIn
有两个条件,我必须渲染一个组件
1:如果用户loggedin
未显示somecomponent
//我已实现
2:但即使用户未处于component
模式,我也需要渲染一些loggedin
。
问题陈述:如何在运行时访问正在呈现的组件
我的方法:用网址抓住
if (this.props.match.url == '/someulr'){
// code for no authntication
}
but what if a url is like this '/someurl/:id' // where id is variable
应用正则表达式对于此
的任何想法都不是一个好主意