cleaning up state and starting using other compoonents

This commit is contained in:
Arjun Patel
2022-01-12 15:19:55 -08:00
parent 20ffd4fecd
commit 470b78667d
2 changed files with 12 additions and 10 deletions
+8
View File
@@ -0,0 +1,8 @@
import React, { useState } from "react";
import { render } from "react-dom";
export default function DashboardRoom() {
const [count, setCount] = useState(0)
return <div>hi</div>;
}
+4 -10
View File
@@ -74,20 +74,14 @@ function getUser(name: string) : User {
return new User()
}
type MyProps = { };
type MyState = {
selectedChannel?: number
};
export default class Demo extends React.Component<MyProps, MyState> {
constructor(props) {
super(props);
this.state = {
selectedChannel: null
}
this.handleKeyboardShortcut = this.handleKeyboardShortcut.bind(this);
export default class Demo extends React.Component<{ }, MyState> {
state: MyState = {
selectedChannel: null
}
componentDidMount(): void {
@@ -126,7 +120,7 @@ export default class Demo extends React.Component<MyProps, MyState> {
}
}
handleKeyboardShortcut(event) {
handleKeyboardShortcut = (event) => {
console.log(event.keyCode)
switch(event.keyCode) {