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

291
Vistas
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 Respuestas
Responde la pregunta

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 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