【发布时间】:2017-08-29 07:41:08
【问题描述】:
我正在使用React Router Native 我想在特定路径上隐藏一个组件
<NativeRouter history={nativeHistory}>
<Route exact path="/" component={Home} />
<Route path="/about" component={About} />
<Footer />
</NativeRouter>
在我的Home 组件中,当单击链接时About 组件必须呈现&Footer 必须隐藏& 其余路由Footer 必须呈现。 Footer 是一个无状态组件。
我尝试在我的Footer 组件中访问props.location,但它的undefined 因为props 是一个空对象{}
我的问题是如何仅将一条路径列入黑名单而不渲染特定组件?
【问题讨论】:
标签: javascript react-native react-router react-router-v4 react-router-native