You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can I pass a dynamic field name to composeValidators so the returned message includes field name as I reuse it for different fields with same validation?
I want to do something like this:
const textValidator = composeValidators(
isRequired,
isAlphabetic
)(dynamicFieldName);
var fieldName1 = 'First Name'
var fieldName2 = 'Last Name'
textValidator()(fieldName1); // 'First Name is required'
textValidator()(fieldName2); // 'Last Name is required'
The text was updated successfully, but these errors were encountered:
Can I pass a dynamic field name to composeValidators so the returned message includes field name as I reuse it for different fields with same validation?
I want to do something like this:
The text was updated successfully, but these errors were encountered: