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

196
Vistas
JSX, can't show the correct link in a new tab

I'm trying to open in a new tab a URL retrieved from an API. It's basically a shortened URL. But when I try to add it to the href attribute of my , it returns me something like:

localhost:3000/[the correct shortened url]

or if I'm deploying the website:

[my website url]/[the correct shortened url]

Here's my component, where the link is the one with the "shortened-url" className:

import { React, useState } from "react";
import "../styles/ModalUrl.scss";
import CloseIcon from "@mui/icons-material/Close";

const ModalUrl = ({ modalClass, setModalClass, shortenedUrl }) => {
  const closeModal = () => {
    setModalClass("hidden");
  };

  return (
    <div className="modal-and-background">
      <div className={`dark-background ${modalClass}`}></div>
      <div className={`modal-url ${modalClass}`}>
        <h1>Your URL is ready!</h1>
        <a href={shortenedUrl} className="shortened-url">
          {shortenedUrl}
        </a>
        <div className="button-container">
          <button className="btn-close" onClick={closeModal}>
            CLOSE
            <CloseIcon className="close-icon" />
          </button>
        </div>
      </div>
    </div>
  );
};

export default ModalUrl;

Thank you!

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