33 lines
686 B
JavaScript
33 lines
686 B
JavaScript
import React, { useState } from 'react';
|
|
|
|
function MyComponent(props) {
|
|
const [count, setCount] = useState('0');
|
|
|
|
function unusedFunc() {
|
|
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>Test</span>
|
|
{list}
|
|
<button onClick={() => setCount('abc')}>Click</button>
|
|
<p>{name}</p>
|
|
</div>
|
|
<h1>Unwrapped</h1>
|
|
)
|
|
}
|
|
|
|
export { MyComponent };
|