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.