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

176
Vistas
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 Respuestas
Responde la pregunta

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 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