Why are you calling setList like that? The array is new and not used anywhere else, no need to copy it again!?
setList is the useState hook. That's why.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.