initial commit
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
|
||||
interface AppProps {}
|
||||
|
||||
function App({}: AppProps) {
|
||||
// Create the count state.
|
||||
const [count, setCount] = useState(0);
|
||||
// Create the counter (+1 every second).
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => setCount(count + 1), 1000);
|
||||
return () => clearTimeout(timer);
|
||||
}, [count, setCount]);
|
||||
// Return the App component.
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<p>
|
||||
Page has been open for <code>{count}</code> seconds.
|
||||
</p>
|
||||
<p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user