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

172
Visualizações
Why is Link component from react-router-dom is not accepting className props?

Here's my PageLink component,

export const PageLink: React.FC<IProps> = ({ id, question, searchBy }) => {

  return (
    <Link to={{pathname: `results/${id}`, search: `?sortBy=${searchBy}`}} className={styles.PageLink}>
      {question}
    </Link>
  );
};

None of the styles that I've written under PageLink is applied to this component. (BTW, I'm using css modules for this).

Based on other answers in SO, I replaced Link with NavLink and it works fine.

So, I have 2 questions,

  1. Why is Link component not accepting className props?

Based on this issue page people are telling that it's not a bug.

  1. Is there anything wrong with using NavLink instead of Link (for my use case)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Update

I just restarted my server and it just works with Link as well. I suspect that there's something funny going on with ts compiler. What's even strange is, I noticed many people asking the same question in different forums.

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