Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!