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

180
Vistas
React window is not closing when the user clicks the button

I open a React web app like this in my index.js file:

ReactDOM.render(
    <React.Fragment>
        <Review pplNum={num} />
    </React.Fragment>,
    document.getElementById('root')
)

I then want the user to be able to close it, but close button doesn't work.

Here is the Review component:

import React, { useEffect } from "react";
import axios from 'axios';

const Review = ({ pplNum }) => {
    axios.put('/books/reviews/' + pplNum)
        .then(res => console.log(res.data));
    return (
        <div>
            <div>Thank you for the review</div>
            <div><a href="javascript:window.close">Click here to close</a> this window</div>
        </div>
    );
}

export default Review;

When I click it to close, nothing happens.

Is there something I am not doing correctly?

Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're not calling it as a function:

<a href="javascript:window.close()">Click here to close</a>
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