I'm trying to wrap my head around using hooks and I'm running into a repeating problem. In the example I've linked below, I have a useEffect hook that's sorting an array. The sorting order is determined by a state value and I have a button that toggles that state value.
Everything is working that way I intended, the array is sorted when the component mounts, and then on the button click.
However, I'm getting a error from the linter that the array of values needs to be declared as a dependency in the useEffect hook. If I do that, I get a 'Maximum update depth exceeded' error. I'm unsure what to do, and I would appreciate any help!
Thanks for taking a look, it really means a lot to me!