There's AntD library with various UX components. Right now I required to wrap all components which I'm using in another layer, to make an abstraction. For example, if I'm using AntForm
component I required to wrap it as follows:
import React from 'react';
import AntForm from 'antd/es/form';
import { FormProps } from './form.types';
export function Form(props: FormProps): JSX.Element {
return (
<AntForm {...props} />
);
}
and redefine all types internally in form.types.ts
as following:
export interface Form { ... }
The justification which I get for this step that if we ever will be required to change a library, we will need to make changes to only this abstraction layer the rest of the code will remain untouched.
I don't like this approach. It requires a tremendous amount of work, especially redefine all the types, and internal types, and internal types of internal types. Personally I would avoid such an architecture solution, especially redefine all the types. In this way, we become bound to specific AntD implementation, and if it will be break changes in AntD, it adds another layer where we will need to make changes. Another point against it, if we will ever need to change the library, we, in any case, will be required to change all the components which using this library, it can't be done 100% abstraction, but it's just a gut feeling based on my previous experience and most likely biased.
Before I'm going to discuss with other people regarding this issue I would like to hear another unbiased opinion, cons, and pros of such an approach.