I am facing any issue in react.
Here How I am defining the class BackendServiceClient
class BackendServiceClient {
private readonly source: string;
constructor(source?: string) {
if (source) {
this.source = source;
}
axios.defaults.headers = this.setDefaultHeaders();
}
}
.... some logic
export default BackendServiceClient;
This how the BackendServiceClient is export in index.ts in common library in this class we export all the vars that could be used by clients of the library
export { default as BackendServiceClient} from './api/BackendServiceClient';
While building this commons library into my application I got error
commons.BackendServiceClient is not constructor
and when checked the line causing errors from file in node modules
backendServiceClient: /*#__PURE__*/new commons.BackendServiceClient(),
Does someone have faced this issue ? Thanks
In JavaScript, objects are created using functions and methods. This programming language allows defining construction functions that act as templates for the creation of objects. These constructor functions can have associated properties and methods that are inherited through the objects created from them. In this way, JavaScript makes it easy to create and manipulate objects efficiently and flexibly.
NODE JS is a programming language that allows you to create objects and also provides some functions and methods for them.