Why I Love Next.js
•5 min read
Here is how I implemented a counter:
import { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0); // This line is highlighted!
return <button onClick={() => setCount(c => c + 1)}>{count}</button>
}