I'm trying to import a class into a react class but when the object changes in the class it returns undefined.
class Test {
constructor(){
this.obj = {}
}
testFunc(){
this.obj.one = 'two'
// this returns the value
console.log(this.obj.one)
}
}
class App extends Component{
constructor(){
super()
this.testClass = new Test()
}
componentDidMount(){
this.testClass.testFunc()
// this returns undefined
console.log(this.testClass.obj.one)
}
}