In a react app, I have some business logic I'm trying to encapsulate in class called Authentication. When I try to call a method called configure on the Authentication class I get the following error:
TypeError: WEBPACK_IMPORTED_MODULE_5__authentication_js.a.configure is not a function
In my React app.js file I import the authentication class with:
import Authentication from './authentication.js';
and then I try to access it inside my constructor as follows:
constructor(props) {
super(props);
Authentication.configure();
}
The code for authentication.js is as follows:
class Authentication {
constructor(props) {
console.log('inside constructor of Authentication class');
}
configure(){
//some setup logic, still fails if I comment it all out
}
}
export default Authentication;
I'm unsure how exactly to troubleshoot this issue. I know I've seen similar issues in react before where an internal method has not had the bind method called against it, but I'm unsure if that is needed for a public method of an external class and if it is required, I'm not sure how to implement it. Any help/guidance would be greatly appreciated.