6

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
2
  • What's the question? Commented Oct 23, 2017 at 15:06
  • @ChaseDeAnda how not to duplicate paths? Commented Oct 23, 2017 at 15:08

2 Answers 2

4

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
Sign up to request clarification or add additional context in comments.

Comments

2

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

1 Comment

Hi sir, that is urlRusLat?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.