So basically I have a function called calculations() that is doing some calculations and returning some objects.
The problem is that in a component, I need to call this function several times to get the objects it returns and it ends up generating a delay in the code. Like that:
const myTest1 = this.calculations().value1;
const myTest2 = this.calculations().value2;
const myTest3 = this.calculations().value3;
console.log(myTest1, myTest2, myTest3)
Is there any way to do this without having to call the function multiple times? I'm using class components so I can't use the hooks from the new version of react.