I've a question regarding the useState
hook since the docs say that it completely replaces the old state with the new one you provided.
unlike this.setState in a class, updating a state variable always replaces it instead of merging it.
Following that can I just destruct whatever property inside an object state and mutate it directly instead of shallow/deep copying it? I mean it doesn't make any sense to shallow/deep copy to mutate it when the old state will be discarded and replaced with a brand new one.
Correct me if I'm wrong because this part confuses me. Also, I made a little sandbox to demonstrate my point.