Trying to help someone with React. React doesn't like it when data mutates. React prefers you to make copies rather than mutate structs in place.

The person I'm helping is using TypeScript classes. Why wouldn't they? But then we discover something weird. If you want to make a copy of a TypeScript object, the two ways to do this are:
- structuredClone
- spread. You could say like, { a:4, ...otherObject } to create a copy of otherObject with "a" changed.

Both of these destroy class identity!

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.social/users/mcc/statuses/115498307120095834 on your instance and quote it. (Note that quoting is not supported in Mastodon.)