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

183
Vistas
Unexpected token '{'

my code looks fine to me but maybe you can find the error. thanks! in vscode, my code does not have an error but when I run it on google chrome, this error shows:

Uncaught SyntaxError: Unexpected token '{'

Context

popup.html

Stack Trace

popup.js:16 (anonymous function)

*and this part was highlighted *: <Button variant="outlined" onClick={textValueFn}>Play</Button>

import ReactDOM from 'react-dom';
import React, {useState} from 'react';

function App() {
  const [text, setText] = useState();
  let textValueFn = (event) => {
    const textValue = event.target.value;
    setText(textValue);
  };

  return (
    <div>
      <Input placeholder="Type in your text here" inputProps={ariaLabel} />
      <Button variant="outlined" onClick={textValueFn}> Play
      </Button>
      <h1>{text}</h1>
    </div>
  );
}



ReactDOM.render( <App/> ,
  document.getElementsByClassName('app')
)
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Maybe the issue here is with ariaLabel prop which you're not passing to the component. And the second issue is with Input and Button components which you're not importing. If you're intended to use native input and button components then just replace Input with input and Button with button.

Here is the change I made in the code:

import React, { useState } from "react";

export default function App({ ariaLabel }) {
  const [text, setText] = useState();

  let textValueFn = (event) => {
    const textValue = event.target.value;
    setText(textValue);
  };

  return (
    <div>
      <input placeholder="Type in your text here" inputProps={ariaLabel} />
      <button variant="outlined" onClick={textValueFn}>
        Play
      </button>
      <h1>{text}</h1>
    </div>
  );
}

Edit zealous-saha-e0mj6

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