Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

415
Vistas
How to pass data between two pages in React js with react router dom -v6 in through class components

I search through articles and went through many stack overflow questions but I am still resolving the issue.


In react router dom v5, it is easier to pass data through state object as shown in the link answers: React-router - How to pass data between pages in React?

In react-router-dom v5:

<Link to={{

pathname: '/show',
 state: {id: 1, name: 'sabaoon', shirt: 'green'}
         }} >
         View Details</Link>   

the state should be received in another page via this.props.location.state.id etc.


but now in v6 the same method is not passing state object to the location of another page.

When I tried to console log the this.props.location on another page to which I am passing data it is giving me 'undefined' on console.

How we can do the same thing with v6.

Note: I want to do it in class component of react not in function component and I don't want to share it through params as well.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda