I want to pass dynamic object
name to a function:
handleValid = (type, v) => {
const validationError = RequestValidation.????.submit(v); // but this is call an object
const value = v; // this is value
}
Here is I pass two parameters to function:
this.handleValid(Object.keys(doValid)[i], Object.values(doValid)[i]);
So type
parameter is dynamic, I don't know how can I set dynamic object name here, what I searched and tried:
const validationError = RequestValidation.[type].submit(v);
Or should use something like:
[`${type}`]
Of course this not working:
const validationError = RequestValidation.type.submit(v);