28 lines
868 B
TypeScript
28 lines
868 B
TypeScript
// This program has been developed by students from the bachelor Computer Science at Utrecht
|
|
// University within the Software Project course.
|
|
// © Copyright Utrecht University (Department of Information and Computing Sciences)
|
|
import { useState } from 'react'
|
|
|
|
/**
|
|
* A minimal counter component that demonstrates basic React state handling.
|
|
*
|
|
* Maintains an internal count value and provides buttons to increment and reset it.
|
|
*
|
|
* @returns A JSX element rendering the counter UI.
|
|
*/
|
|
function Counter() {
|
|
/** The current counter value. */
|
|
const [count, setCount] = useState(0)
|
|
|
|
return (
|
|
<div className="card">
|
|
<button onClick={() => setCount((count) => count + 1)}>
|
|
count is {count}
|
|
</button>
|
|
<button className='reset' onClick={() => setCount(0)}>
|
|
Reset Counter
|
|
</button>
|
|
</div>
|
|
)
|
|
}
|
|
export default Counter |