Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
Download button in react to csv link not working within material-ui table

I am trying to workout how to include a csv file link to a button within my react material table cell.

From the backend db, I have a column that holds a link to a csv file on a server, i.e.

filePath = 'https://my-file-server/files/outcome.csv'

that has been assigned to filePath within my react component.

I then want to basically emulate a <a href={filePath}>Download CSV</a> within my table cell, so tried using React-Router Link, i.e.:

import { Link } from 'react-router-dom';

<TableCell>
  <Link to={filePath}>
    <Button>
      Download CSV
    </Button>                  
  </Link>
</TableCell>

Now I am running my app from localhost:3000/my-route and when I click on my Download CSV button, it actually changes my url path to:

http://localhost:3000/my-route/my-file-server/files/outcome.csv

which is not what I want. I actually expected it to point directly to:

https://my-file-server/files/outcome.csv and then thought it would just download within my browser to my computer's download directory.

Unsure what I am doing wrong?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda