I am getting the following error when submit:
"4. The total production should increase correctly after each producer purchase"
Here is my handlers.js file:
import {updateGold} from './functions.js'
export const handleKeyPress = (term, state) => {
return (name, matches, data) => {
//updateGold(term, state);
const key = String.fromCharCode(data.code);
if (key === 'g' || key === 'G') {
state.gold++;
} else {
for (let i = 0; i < state.producers.length; i++) {
if (key === String(state.producers[i].id)) {
state.gold -= state.producers[i].cost;
state.producers[i].cost = state.producers[i].cost * state.producers[i].growthRate;
state.producers[i].count++;
state.productionRate ++;
}
}
}
}
}
export const handleStateChange = (term, state) => {
return () =>{
updateGold(term, state);
}
}
Thanks!