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

115
Views
Representa dinámicamente un campo de entrada específico de tipo al seleccionar una opción de la lista desplegable en reactjs

Soy nuevo en reaccionar y tengo una lista desplegable con algunos valores, y quiero agregar un nuevo campo de entrada al seleccionar una opción de la lista desplegable. Esto es lo que tengo hasta ahora,

 import React, { useEffect } from 'react'; #creating an array of options const options = [ { name: 'First Name', id: 'text' }, { name: 'Last Name', id: 'text' }, { name: 'Phone', id: 'number' } ]; export const UserInputDefault = { users: [], userId: [] } #create component const CreateNewUser = (data, setData) => { const setType = (type: string, index: number) => { if (index < 0 || index >= data.users.length) { return; } setData(update(data, { users: { [index]: { type: { $set: type } } } })); }; return ( <div> <SelectList options={options} label="Input Type" action={(value: string) => {setType(value, index)}} selectedOption={data.questions[index].type} /> <br/> #text input component <TextInput variant="outlined" label="Display Text" value={data.questions[index].displayText} variables={[]} setValue={(value: any) => {setDisplayText(value, index)}} mode="html" error={Boolean(error?.displayText?.index === index && error?.displayText)} /> </div> ); } export default CreateNewUser;

Estoy un poco perdido después de esto. Quiero que el usuario pueda seleccionar una opción (Nombre/Apellido/Teléfono) condicionalmente desde el menú desplegable y se debe insertar un nuevo elemento de entrada al seleccionar una opción.

about 4 years ago · Juan Pablo Isaza
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!