I am working with multiple forms . In some cases the forms having similar fields eg, name , phone number , account number etc.., . I am using formik as well . I have created schema file (schema.js) for each form . Inside that i have listed down all the schema validation and return that schema.
eg : schema.js
const schema = yup.object().shape({
firmName: yup.string().label(Labels.FIRM).max(255)
});
export default schema;
If i have 10 forms which has firmName field all my schema.js file has above propert firmName.
I am not sure how to separate it and reuse it .
If anyone has faced and solved similar case please let me know the way.
In the above way of coding got increasing the duplication percentage in sonar scan. Please help