score:3

Accepted answer

We've all seen this problem at one time or another in our careers. It's surprising that I didn't catch this.

The problem is that the context of this in handleSubmit() is different because of how handleSubmit is called. Changing handleSubmit into a fat arrow definition works:

public handleSubmit = (event: React.FormEvent) => {

In this particular case, I overlooked that because I don't run into this problem often in the TypeScript world (I also don't work with DOM elements often, and have been with React for under a week... no excuses, I know)


Related Query

More Query from same tag