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

134
Views
cómo almacenar el valor de la nueva línea del área de texto en una matriz con reaccionar y enviarlo a la variable del nodo js con la solicitud posterior

cómo almacenar el valor de la nueva línea del área de texto en una matriz con reaccionar y enviarlo a la variable del nodo js con la solicitud posterior

const [inputvalue, setInputvalue] = useState("");

 const handleSubmit = (e) => { e.preventDefault(); try { axios.post('/inputData', inputvalue , { headers: { 'Content-Type': 'text/plain' } }) .then((response) => { setData(response.data); }); } catch (e) { console.log('Error!', e); } }
 <form onSubmit={handleSubmit}> <TextField id="outlined-multiline-static" label="Multiline" multiline rows={4} onChange={(e) => setInputvalue(e.target.value)} value={inputvalue} placeholder="Enter your keyword" /> <button type="submit" className="btn btn-primary mt-3" onClick={() => setLoading(true)}>Click here</button> </form>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No sugiero mantener el valor de entrada como una matriz (ya que interferirá con la salida de su área de texto). Sin embargo, puede crear fácilmente la matriz cuando la envía a través de axois.

Simplemente use ".split(/\n/)" en su solicitud para crear la matriz de valores.

Es posible que desee hacerlo como:

 axios.post('/inputData', { values: inputvalue.split(/\n/) } , { headers: { 'Content-Type': 'text/plain' } }) .then((response) => { setData(response.data); });
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!