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

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

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