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

181
Views
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 answers
Answer question

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