dlhg / burgerclicker

0 stars 0 forks source link

clicking burger one time yields Total Burgers Produced: 2 #2

Closed dlhg closed 1 year ago

dlhg commented 1 year ago

Burgers: 1 Total Burgers Produced: 2 Burgers Per Second: 0 Burgers Per Click: 1 Burgers Made By Clicking: 1 Burgers Made By Automation: 0

dlhg commented 1 year ago

fixed by updating useffect, still would be good to understand why i need to multiply burgs from automation by two here: useEffect(() => { //why does burgers from automation need to be multiplied by 2? console.log('checking') setTotalBurgersProduced(formatNumber(((burgersMadeFromClicking) + (burgersMadeFromAutomation * 2)))) }, [burgersMadeFromClicking, burgersMadeFromAutomation])