add counter component
This commit is contained in:
parent
e3ca67d6dc
commit
1712f9edb6
1 changed files with 17 additions and 0 deletions
17
examples/blog/astro/components/Counter.jsx
Normal file
17
examples/blog/astro/components/Counter.jsx
Normal file
|
@ -0,0 +1,17 @@
|
|||
import React, { useState } from 'react';
|
||||
import confetti from 'canvas-confetti';
|
||||
|
||||
export default function Counter() {
|
||||
// Declare a new state variable, which we'll call "count"
|
||||
const [count, setCount] = useState(0);
|
||||
console.log(confetti());
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p>You clicked {count} times</p>
|
||||
<button onClick={() => setCount(count + 1)}>
|
||||
Click me
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue