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

289
Views
Button hyperlinks not working in react jsx

Hi I made a loaded page but it's giving me an error and I'm not sure from what so I came here to ask if you know what caused it. Error message:

ERROR in src\components\pages\Bookings.js Line 24:12: Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (24:12) Code:

import React, { Component } from "react";
//just initialised but will have to get rid of css later

function click() {
    window.onload = function(){
        if(document.getElementById("ArtsButt").onclick) {
            window.open("link 1");
        }
        if(document.getElementById("SciButt").onclick) {
            window.open("link 2");
        }
        if(document.getElementById("EveButt").onclick) {
            window.open("link 3");
        }
    }
}


class Bookings extends Component {
    render() {
        click();
        return (
            <button type="button" id="ArtsButt">Arts</button>
            <button type="button" id="SciButt">Sciences+Eng</button>
            <button type="button" id="EveButt">Evening</button>
        )
    }
}

export default Bookings;

If you know how to fix this please let me know and thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

React component must return a single React Node, therefore your nodes must have a common single parent, you can wrap them with React.Fragment, for example:

<>
  <button type="button" id="ArtsButt">
    Arts
  </button>
  <button type="button" id="SciButt">
    Sciences+Eng
  </button>
  <button type="button" id="EveButt">
    Evening
  </button>
</>
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!