0
我routes.jsx
模样如何使用react-router渲染基于路线的容器/组件?
return (
<Route path='/' component={Main}>
<IndexRoute
component={Home}
onEnter={onSearchEnter}
onChange={(prevState, nextState) => onSearchEnter(nextState)}
/>
<Route path='privacy' component={Privacy} />
<Route path='terms' component={Terms} />
<Route path='dmca' component={DMCA} />
<Route path='clips/:clip' component={Clip} />
</Route>
)
在我的Main
,我有这样的:
render() {
return (
<div className={`main__container ${get(this, 'props.children.type.parentClassName')}`}>
{(() => {
return (
<Nav
downloadLinks={this.props.downloadLinks}
search={this.props.search}
/>
)
})()}
不过,我不希望渲染Nav
成分,如果我在clips/:clip
路线我。
我使用react-router