I
I
Ivan2019-08-14 15:19:51
typescript
Ivan, 2019-08-14 15:19:51

How to dynamically change input type value?

An array of objects comes from the server, which fills the table

<ModuleStatus>Конфигурация: {modules.map(module =>
          <Module key={module.param.toString()}>
          <ModuleParam>{module.param}</ModuleParam>
          <ModuleValue name={module.param} type='text' value={module.value} onChange={this.handleValueChange} />
        </Module>)}
        <PutNewConfigs type='submit' value='Сохранить изменения' onClick={this.putNewConfigs}/>
        </ModuleStatus>
. 5d53fc48c9b61161094216.pngThe ModuleValue input type is text by default. How to make it so that when the value module.param === work_mode is received, the input type changes to select and the value of module.value becomes one of its options?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question