import { useState } from 'react'
type SampleProps = {
text : string
required ?: boolean
}
export function SampleComponent({ text, required } : SampleProps ) {
const [count, setCame] = useState<number>(0)
function handleClick = () => {
const newValue = count + 1
setCount(newValue)
}
return (
<div>
<p>{text}</p>
<p>{!required ? '필수 아님' : '필수'}</p>
<button type='button' onClick={handleClick}>증가</button>
</div>;
)
}