Closed oveddan closed 4 years ago
When I was writing the class, it was a hard decision to make. Personally I like OOP and prefer modifying values in place.
Generally in react land you don't want to mutate the variable, but just return a new one.
However, as you said, this is a React convention, I will follow it~
Currently - a lot of the operations on the Vector change the vectors values, like,
add
for example:It is better to not modify the vector itself, but to just return a new one.
Doing something like:
should not modify a - because even though
a
will have a different value inside, it will be considered the same as before.Generally in react land you don't want to mutate the variable, but just return a new one.