useState
useState ~10 mins - nextjs

useState

    import { useState } from "react";
const [count, setCount] = useState(0);

Action

    <button onClick={() => setCount(count + 1)}>Click me</button>

Task 1: Create a Counter program which increases the count value

    "use client";

import { useState } from "react";

export default function Counter() {

const [count, setCount] = useState(0);
return (
<main>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>Click me</button>
</main>
);
}