Shallow Copying JavaScript Classes
TL;DR
React's useState uses Object.is to detect state updates.
When using Array or plain Object, you can trigger updates using the spread syntax.
The spread syntax provides a so-called shallow copy, and we want to use this with class instances.
The Case of Classes
The solution is the following method:
Here is a practical example: