I am trying to create a router link through my application,
In this case, I have three files.
App.js
Book.js
DetailedView.js
I have created a book inside <Link>that appears only when it hangs (above the cover of the book)
{this.state.isHovered ? (
<Link to={`/details/${this.props.book.industryIdentifiers[1].identifier}`}>
<div className="hover-box"></div>
</Link>) : ( <div /> )}
This will lead me to / details / 12345 (isbn10 number)
What I find difficult to understand is, for example,
setState({iPressedThisBook})by clicking <Link>or if I can use the part afterwards /12345to create it as a filter
Because in App Routewill be connected as ...
<Route path="/details/:id" render={() => (
<BookDetailedView
bookStateUpdated = {this.bookStateUpdated}
book = {this.state.books}
/>
)}/>
I later want to capture :idwhat I do, for example, this.props.book.find(:id)inside my<BookDetailedView>
source
share