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

530
Visualizações
React routes param auto decode string

Hi does react router params automatically decodes string?

For example i have this route

<Route path="/callback/:url"/>

and when I call it with C5jb20%3D

it will print C5jb20= when I console.log() that parameters

Is this an expected behavior? Can I change this behavior so that I still get the encoded string?

Thanks!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

C5jb20%3D is a URL encoded string, which is a way to encode special characters in a URL. For example, if you have a URL parameter like ?redirect=/some/path, a server could interpret the forward slashes as routing paths, and mess up the expected routing. That's why you see things like ?redirect=%2Fsome%2Fpath, and your example, in URLs.

window.location.path will have the original, unencoded URL.

You could also get it back with encodeURIComponent:

encodeURIComponent('C5jb20=') // "C5jb20%3D"

You probably don't want to, though, depending on your use case.

over 4 years ago · Santiago Trujillo 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