Next.js beginner 15 min

State

Learn about State in Next.js.

State

State is data that a component can hold and update. When state changes, React automatically updates the part of the UI that uses that state.

Example

const [count, setCount] = useState(0);

Practice

Create a counter component. The number should increase when a button is clicked.