Unlike languages where this is lexically bound to a class instance at definition time, JavaScript decides what this refers to at the moment a function is called, not where it was written. That single distinction has caused more runtime errors than any other keyword in the language. The refactor looked completely safe. A method called updateUser lived on a userStore object, and a component needed to call it in response to a button click. Someone extracted the reference to make the cod...