Open iwaggoner opened 2 years ago
My first thought is to flip your for loop to a while loop that checks multiple conditions (using AND), one of which is a state that is changed by a key or button press?
Add a piece of state that will make the function run something like if(funcRunningState === true){run the function}
and update that piece of state(funcRunningState
) to be false when the button is clicked. Give that a try and let me know how it goes
Because it is async and recursive it takes in the states when called and then never looks at them again even if they are changed
Once the function starts running the only way for it to stop is the if(n === 1) we could add a conditional but it ignores state changes
well that's a bitch
What stack are you using?
(ex: MERN(mongoose + react), DR(django + react), PEN, etc.)
MERN
What's the problem you're trying to solve?
we run a sort and it will run untill it's complete we want to have a way to stop it early
Post any code you think might be relevant (one fenced block per file)