import { useState } from "react"; import { Heading } from "@servicenow/react-components/Heading"; import { ButtonIconic } from "@servicenow/react-components/ButtonIconic"; interface Props { title: string; initialCount: number; } const Counter = ({ title, initialCount }: Props) => { const [count, setCount] = useState(initialCount); const add = (factor = 1) => { setCount(count + factor); }; return (
add(-1)} disabled={count === 0} /> add()} />
); }; export default Counter;