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

121
Views
Write to Paragraph from Text Inputs with React

I am working on some code that takes the inputs from two textboxes, one that takes a string value and one that takes a number value, and in real time writes it to a paragraph without a submit button. I am having trouble finding any information on this process without submitting anything. The paragraph should just display . To begin, this is what I have:

import './App.css';

function App() {
  return (

    <div>
      <form>
        <div>String:</div>
      <input type="text" strng = "strng" /><br/><br/>
        <div>Number:</div>
      <input type="text" strng = "number"/><br/><br/>
      <button>Clear</button>
      <p>
        Inputs: 
      </p>
      </form>
    </div>
  )
  }
  export default App;

Would someone be able to help me out with writing the two text boxes to the paragraph in real time? Thanks so much in advance.

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

0

You should be able to bind a useState with the onChange event of the input

import './App.css';
import { useState } from "react";

function App() {
  const [text, setText] = useState("");

  return (
    <div>
      <form>
        <div>String:</div>
        <input
          type="text"
          strng="strng"
          onChange={(e) => setText(e.target.value)}
        />
        <br />
        <br />
        <div>Number:</div>
        <input type="text" strng="number" />
        <br />
        <br />
        <button>Clear</button>
        <p>Input: {text}</p>
      </form>
    </div>
  );
}
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!