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

271
Vistas
React Link to open new tab

I Have a React link in my material table.

  actions={[
         rowData => ({
               icon: () => <Link   style={{ fontSize:"15px" ,fontSize:'15px'}} to={{pathname:'/VV',state: rowData  }} >View</Link> ,
               onClick: (rowData)
             })
           ]} 

I want to be able to open a new tab on the click.

But my child objects keep getting Cannot read properties of undefined when i decide to open it in a new tab

Please can i have some assistance i've been stuck on this problem.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is a simple way you can do that without React-Router library,

Make a Link component like blow and use it.

const Link = () => {
    const linkRef = useRef(null)
    const handleClick = () => {
         linkRef.current.link.click()
    }
    return (
       <div ref={linkRef} onClick={handleClick}> 
          <a href="http://google.com" target="_blank">Go to google!</a>
       </div>
    )
}

You can put the link you want in href and render the Link component where you want! also you can give it a style you want cuz it's a component! :D

I hope you find an answer!

about 4 years ago · Juan Pablo Isaza Denunciar
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