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

111
Views
agregue una matriz de cadenas en el objeto usando 2 funciones

Estoy creando un NoteEditor, usando reaccionar. Tengo 2 áreas de texto en mi ventana emergente, y cuando intento agregar mi conjunto de cadenas en el objeto, tengo un error, mi variable, que contiene este conjunto de cadenas, devuelve 'indefinido', cuando hago clic en el botón Agregar Nota.

Existe mi función onDescriptionChange , tomo e.target.value de mi área de texto y lo agrego a la variable arrayOfStrings , donde divido esta cadena en una matriz con palabras:

 let onDescriptionChange = (e) => { setTextAreaHeight(e, '100px'); let stringToSplit = e.target.value; let arrayOfStrings = stringToSplit.split(' '); return arrayOfStrings; };

Hay una función addArrayToNote , donde intento agregar este arrayOfStrings a la descripción:

 let addArrayToNote = (arrayOfStrings) => { setNote({ ...note, description: arrayOfStrings, }); addNote(); };

estare muy agradecido si me ayudan...

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

0

Creo que desea invocar el método addArrayToNote después de generar arrayOfStrings .

 let onDescriptionChange = (e) => { setTextAreaHeight(e, '100px'); let stringToSplit = e.target.value; let arrayOfStrings = stringToSplit.split(' '); // return arrayOfStrings; instead of returning the value addArrayToNote(arrayOfStrings) // invoke the addArrayToNote with the strings. };
 let addArrayToNote = (arrayOfStrings) => { setNote({ ...note, description: arrayOfStrings, }); addNote(); };

Espero que esto ayude.

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!