In heder there is a component with live search in which there are links for the found film or TV series depending on what came from the server.
Use react-route v4
urlRusLat - just a function that returns translate name a movie
<div>
<Helmet>
<title>Movie-search</title>
</Helmet>
<Nav/>
<Header/>
<Switch>
<Route exact path="/" component={Main} />
<Route exact path="/movie/:urlRusLat" component={Movie} />
</Switch>
</div>
and link in the search result
<Link to={item.media_type + '/' + urlRusLat(item.title || item.name) + '-' + item.id} className="result-element" key={index}>
and when I'm on the page of the movie and choose something from the search, then my path becoming like this
/movie/some-movie/movie/some-movie
how do that, when I click on the link in /move/some-movie
/movie/some-movie
how not to duplicate paths?
asked Oct 23, 2017 at 15:02
Drop
1,5923 gold badges17 silver badges28 bronze badges
-
What's the question?Chase DeAnda– Chase DeAnda2017年10月23日 15:06:21 +00:00Commented Oct 23, 2017 at 15:06
-
@ChaseDeAnda how not to duplicate paths?Drop– Drop2017年10月23日 15:08:25 +00:00Commented Oct 23, 2017 at 15:08
2 Answers 2
Just don't forget to add the / add the beginning of the route
<NavLink activeClassName="activePage" to="/something/new/">Create Participants</NavLink>
answered Aug 5, 2019 at 9:20
Alfrex92
6,86612 gold badges37 silver badges55 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Try this code:
<Link to={'/' + item.media_type + '/' + urlRusLat(item.title || item.name) + '-' + item.id} className="result-element" key={index}>
answered Oct 23, 2017 at 15:15
Slawa Eremin
5,42521 silver badges29 bronze badges
1 Comment
Four
Hi sir, that is urlRusLat?
lang-js