我想显示一个title以<AppBar />某种方式从当前路线传入的内容.
在React Router v4中,如何<AppBar />才能将当前路由传递给它的title道具?
<Router basename='/app'>
<main>
<Menu active={menu} close={this.closeMenu} />
<Overlay active={menu} onClick={this.closeMenu} />
<AppBar handleMenuIcon={this.handleMenuIcon} title='Test' />
<Route path='/customers' component={Customers} />
</main>
</Router>
Run Code Online (Sandbox Code Playgroud)
有没有办法通过从自定义自定义标题prop上<Route />?
我正在尝试通过我的应用程序构建路由器链接,
在这种情况下,我有三个文件.
App.js
Book.js
DetailedView.js
我在书内建立了一个<Link>只在悬停时出现(在书籍封面上)
{this.state.isHovered ? (
<Link to={`/details/${this.props.book.industryIdentifiers[1].identifier}`}>
<div className="hover-box"></div>
</Link>) : ( <div /> )}
Run Code Online (Sandbox Code Playgroud)
这将带我到/ details/12345(isbn10号码)
我很难理解的是,例如
setState({iPressedThisBook})在按下时,<Link>或者如果我可以使用后面的部件/12345来创建像过滤器一样
由于App在Route将安装成...
<Route path="/details/:id" render={() => (
<BookDetailedView
bookStateUpdated = {this.bookStateUpdated}
book = {this.state.books}
/>
)}/>
Run Code Online (Sandbox Code Playgroud)
我,后来,想要抓住,:id以便我做一个例如this.props.book.find(:id)我的内部<BookDetailedView>