I have multiple inputs on the page, I'd like to handleChange by only one function which I'm doing already with this code:
handleInputChange(event) {
let modules = this.props.templateModules.slice()
let inputs
for(let i in modules) {
inputs = modules[i].fields
}
for(let i in inputs){
if(inputs[i].name === event.target.name){
inputs[i].value = event.target.value;
this.setState ({inputs});
break;
}
}
}
the structure of those modules (which are added dynamically on button click) from console is:
and the input fields withing each of the module:
as you can see the names unfortunately are not unique thus why my code is not working as it should be if there is more than one module on the page. I'd like to map only the fields of module currently on focus (guess that could be an option) just not sure how to do it.
Any ideas? :)