diff options
Diffstat (limited to 'examples/container-with-vitest/src/components/Counter.jsx')
-rw-r--r-- | examples/container-with-vitest/src/components/Counter.jsx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/container-with-vitest/src/components/Counter.jsx b/examples/container-with-vitest/src/components/Counter.jsx new file mode 100644 index 000000000..2148bf3d8 --- /dev/null +++ b/examples/container-with-vitest/src/components/Counter.jsx @@ -0,0 +1,14 @@ +import { useState } from 'react'; + +export default function({ initialCount }) { + const [count, setCount] = useState(initialCount || 0); + return ( + <div className="rounded-t-lg overflow-hidden border-t border-l border-r border-gray-400 text-center p-4"> + <h2 className="font-semibold text-lg">Counter</h2> + <h3 className="font-medium text-lg">Count: {count}</h3> + <button + className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" + onClick={() => setCount(count + 1)}>Increment</button> + </div> + ) +} |