Questions tagged [react-link]

45 questions
4
votes
2 answers

Typical differences between routers and links in NextJS

I am new to NextJS. I would like to know the typical variations and use cases between next/router and next/link. Which one should I use in various scenarios? Which does what? For instance, if I want to load shared components or navigate among pages…
geobudex
  • 536
  • 1
  • 8
  • 24
3
votes
1 answer

this.props.location.state is undefined in React Link Router

I've seen several of these questions on Stack Overflow, but none of the fixes seem to work. this.props.location.state always returns undefined. Here is my AppContainer, ExamplePageParent, and ExamplePage. import {Router, Route, Switch} from…
penguin
  • 143
  • 3
  • 11
2
votes
3 answers

How to get React Router to recognize a new route on a dynamic path

So I have a NavBar component and the links created work fine if I am going from "/sites/1" to "/categories/1" or anything with "/sites" to "/categories" or even "/sites/1" to "/sites" but doesn't work when I am on a category show page aka…
Katame
  • 61
  • 6
2
votes
1 answer

How to change state through react-router-dom Link?

I am trying to change the state through a Link component when I click on an image. I'm not sure if it's how the Link component is written or if the clickHandler is incorrectly used, but it console logs the state as true even after I click it. import…
Tommy Wu
  • 21
  • 2
2
votes
3 answers

react-router-dom(ReactJS) nesting components

Hello React developers, I've been working on a multi-site react projet, but now i've ran in small issue, which im not know how to fix. My Problem is Following: I've got a component which looks like: import React from 'react' import { Link } from…
Laurenz1606
  • 88
  • 13
2
votes
1 answer

React - How do i persist a page url after refresh?

In my react app, i have stored the respective page names in the local storage depending on the clicked page name i.e for a route say http://localhost:3000/Products i have stored the name Products in the localstorage whenever i click on the page…
Shadow Walker
  • 979
  • 5
  • 27
  • 51
2
votes
1 answer

How do I hide/unhide React link without refreshing my webpage?

I've created 4 links in Header. Home, Todos, Login, Logout. Here is the thing what I want Home, Todos and Logout links are only available when user is logged in. I have used sessionStorage to check whether user is logged in or not and it works…
1
vote
2 answers

How to wrap hashtag and @username with next Link?

I am working on an application where users can create posts and can mention other users and use the #hashtag in the post. Through API call I get the list of post, now the question is how can we wrap hashtags and usernames with next.js Link component…
Anurag Tripathi
  • 784
  • 1
  • 13
  • 13
1
vote
2 answers

Why is `` not working in form submission in reactjs v.18, react router dom v6.3?

I will try to explain to the best where you can understand the issue. If you see there is a button in both AddContact.js and EditContact.js, such as, Add button and Update button. They are wrapped by . However, if I click on the…
1
vote
1 answer

Uncaught TypeError: Cannot read properties of undefined (reading 'pathname')

When clicking on a button, the system raises the following error, rather than navigating to the ProductDetail component: Uncaught TypeError: Cannot read properties of undefined (reading 'pathname') The product id in the url is correctly identified,…
Andrea
  • 13
  • 1
  • 5
1
vote
2 answers

React couldn't pass a data from one class component into another using Link

I am trying the pass data to a new page by using Link, in doing so I used the following code.
1
vote
1 answer

How to separate the array items in my list of actors?

I am trying to separate the displayed list of actors (which will also act as a link to the actors bio page) that each movie will have in my "netflix-like" app with a comma followed by a space between each actor. What I currently have now tells me…
Jop
  • 125
  • 1
  • 12
1
vote
1 answer

How we can link sidebar menu item with app body?

I have a react.js project, I want to link sidebar menu as I drawn in image below. When any users click the side menu items, it can be linked theirs body. I was search so many materials on internet, they do easy, but I do not know how to apply this…
user10991969
1
vote
1 answer

React, Link to component wont load until page is refreshed

React, Link to component wont load until page is refreshed My Link for terms and conditions won't load until the page is refreshed view the video below here. https://youtu.be/2QumWBRXiuM Here is the Footer.js code The link to the page should be on…
Cathal
  • 171
  • 1
  • 1
  • 8
1
vote
0 answers

Right click to open React Link in new tab is throwing 404 Not Found error

I am using react-router-dom Link to navigate to a page and the code is as below: Click here to Login This works fine when the application is running on my local machine. But on server, when I try to right click and…
1
2 3