Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/flo-bit/shapecraft. flo-bit.dev/shapecraft
Something went wrong. Try again.
603 B · 29 lines
JavaScript
at commit d64d0486
123456789101112131415161718192021222324252627282930import { useState } from "react";
export default function Counter() { const [count, setCount] = useState(0);
const increment = () => { setCount(count + 1); };
const decrement = () => { setCount(count - 1); };
return (<div className="flex items-center justify-center gap-2"> <button className="block bg-red-500/10 px-2 py-1 rounded-md text-red-400" onClick={decrement}> - </button> <span>Count: {count}</span> <button className="inline-flex bg-blue-500/10 text-blue-400 px-2 py-1 rounded-md" onClick={increment}> + </button></div> );}