diff --git a/src/App.tsx b/src/App.tsx
index f819cbdb9..8170f2d04 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,7 +1,37 @@
import React from 'react';
-export const App: React.FC = () => (
-
-
The last pressed key is [Enter]
-
-);
+type State = {
+ pressedKey: string;
+};
+
+export class App extends React.Component {
+ state: State = {
+ pressedKey: '',
+ };
+
+ handleKeyPress = (event: KeyboardEvent) => {
+ this.setState({ pressedKey: event.key });
+ };
+
+ componentDidMount() {
+ window.addEventListener('keyup', this.handleKeyPress);
+ }
+
+ componentWillUnmount() {
+ window.removeEventListener('keyup', this.handleKeyPress);
+ }
+
+ render() {
+ const { pressedKey } = this.state;
+
+ return (
+
+ {!pressedKey ? (
+
Nothing was pressed yet
+ ) : (
+
{`The last pressed key is [${pressedKey}]`}
+ )}
+
+ );
+ }
+}