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

185
Views
React input to change variable value

I am writing a script where I have to change a variable value same as the input. This is my script. It should change whenever the input is changed -

    const handleUserInputChange = (e) => {
      MeetingIDi = e.target.name;
      fetchTrans()
      
    };

return <RightWrapper>
        <Header>
          <Button onClick={handleDelete}>Delete Transcription</Button>
          <Button onClick={signOut}>Sign out</Button>
          <input type="text" placeholder="Meeting ID" value={MeetingIDi} onChange={handleUserInputChange}/>
        </Header>

The value is not changing on input somehow

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

// Initialize MeetingIDi with a value of '' (use whatever you want)
const [MeetingIDi, setMeetingIDi] = useState('')

const handleUserInputChange = (e) =>
{
  setMeetingIDi(e.target.name);
  fetchTrans()
};

return <RightWrapper>
        <Header>
          <Button onClick={handleDelete}>Delete Transcription</Button>
          <Button onClick={signOut}>Sign out</Button>
          <input type="text" placeholder="Meeting ID" value={MeetingIDi} onChange={handleUserInputChange}/>
        </Header>

Using the state hook

about 4 years ago · Juan Pablo Isaza Report

0

you can try to create a react useState hook to store the values in it and when the input is changing set the 'setValue' to the target value. Like the code below:

    const[value,setValue]= useState('');

return <RightWrapper>
        <Header>
          <Button onClick={handleDelete}>Delete Transcription</Button>
          <Button onClick={signOut}>Sign out</Button>
          <input type="text" placeholder="Meeting ID" value={value} onChange={(e)=>setValue(e.target.value)}
        </Header>
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!