I am trying to dynamically add the field name and value in the javascript object using es6 structuring. The problem is its not using the value just the fieldName
updateValue(event){
let varName = event.target.dataset.field;
this.realFormData = {...this.realFormData , varName : event.detail.value};
console.log( this.realFormData);
}
Console.log OP: {somefield:"someValue" , varname : "somevalue"}
As you can see, it has used field as varName and not the value of varName
How to bind value of varName
instead of its string?