Skip to content Skip to sidebar Skip to footer

How Do I Approach Solving This Problem: Cannot Access 'calculationEntry' Before Initialization?

I'm developing a large CRA single page app. It has been running fine for months, with the normal bugs that are normally fixable. A couple of weeks ago it failed by just hanging in

Solution 1:

The problem exists because the function was declared as an arrow function. So it is declared but not initialized. The compilation phase is hoisting this uninitialized variable in the temporal dead zone which causes the TDZ exception. Changing the function declaration to "function calculationEntry() {...}" solves the problem.


Post a Comment for "How Do I Approach Solving This Problem: Cannot Access 'calculationEntry' Before Initialization?"