gc-tools/src/App.tsx

47 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-04-30 06:31:57 +00:00
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
2022-04-30 06:31:57 +00:00
import Main from "./components/Main";
import {BrowserRouter} from "react-router-dom";
import Navbar from "./components/Navbar";
import Header from "./components/Header";
2022-04-30 06:31:57 +00:00
interface IState{
headerTitle: string;
}
2022-04-30 06:31:57 +00:00
export default class App extends Component<{},IState>{
constructor(props:{}) {
super(props);
this.state = {
headerTitle: 'Hello World'
}
}
handleHeaderTitleChange = (headerTitle:string) =>{
this.setState({
headerTitle: headerTitle
})
}
render() {
const NavbarProps = {
headerTitle: this.state.headerTitle,
handleHeaderTitleChange: this.handleHeaderTitleChange
}
const HeaderProps = {
name: this.state.headerTitle,
}
const MainProps = {
handleHeaderTitleChange: this.handleHeaderTitleChange
}
return(
<BrowserRouter>
<Navbar {...NavbarProps}/>
<Header {...HeaderProps}/>
<Main {...MainProps}/>
</BrowserRouter>
)
}
}