Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

295
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda