Question: In my *render()* I have the following component with event handling.

```
render() { ...
  <input type="text" 
         onChange={(_) => { this.restate("email", _.target.value); }} />
}

private restate(type: string, input: any) { ...
  if (type === "email")
    this.setState({ ... });
}

```

This works and behaves as supposed to. Since I'm learning React right now, I try to improve my syntax so it's smooth on the eyes. I've found [this answer](https://stackoverflow.com/a/49820103/1525840) and liked the brevity of the event handler assignment. So I've changed my rendering and implemented the handler to be passed as follows.

```
render() { ...
  <input type="text" onChange={ this.handleEmail } />
}

private handleEmail(data: React.ChangeEvent<HTMLInputElement>) {
  console.log("hit before: " + data.target.value);
  console.log(this);
  this.restate("email", data.target.value);
}

```

The change in the markup seems to work, because the method *handleEmail(...)* is invoked. However, I get an error saying that *restate(...)* is not a method of *undefined* and, in fact, when I investigate what *this* is, I discovered it's *undefined*.

I need help understanding what I'm doing wrong and how it deviates from the article linked to above. I tried to google for the syntax differences between versions of React but got nothing. And I'm not sure how to describe the issue in correct technical terms.

Answer: 
To build up on [SPY\_me's answer](https://stackoverflow.com/a/61668448/14769872), here is my solution if you're using Gradle:

```
repositories {
    // ...
    maven {
        name = 'minecraft-repo'
        url = 'https://libraries.minecraft.net/'
        // this lets gradle know where to look for authlib
    }
}

dependencies {
    // ...
    compile 'com.mojang:authlib:1.5.21'
    // this adds the library to the project and the jar when you compile your project
}

```

If you want to download this library directly, here is the jar:

<https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar>
```html
    <repositories>
        <repository>
            <id>minecraft-repo</id>
            <url>https://libraries.minecraft.net/</url>
        </repository>
    </repositories>

    <dependencies>
       <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>1.5.21</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
```