36 lines
755 B
TypeScript
36 lines
755 B
TypeScript
import React, { useState } from 'react';
|
|
|
|
type Props = { title?: string };
|
|
function App(props: Props) {
|
|
const [count, setCount] = useState<string>(0);
|
|
|
|
function unusedFunc(): string {
|
|
return 'unused';
|
|
}
|
|
|
|
const name = props.username;
|
|
|
|
const arr = [1,2,3];
|
|
const list = arr.map(item => <li>{item}</li>);
|
|
|
|
const style = { color: 'red', fontWeight: 500 };
|
|
|
|
let result = value + 1;
|
|
|
|
setCount(count++);
|
|
|
|
return (
|
|
<div style={style}>
|
|
<span>Hello World</span>
|
|
{list}
|
|
<button onClick={() => setCount('abc')}>Click</button>
|
|
<p>{name}</p>
|
|
</div>
|
|
<h1>Unwrapped</h1>
|
|
)
|
|
}
|
|
|
|
export { App };
|
|
|
|
const unused = 123;
|