State is a built-in object that contains data that may change over time.
It's managed within the component and can be updated using setState (class components) or useState hook (function components).
State is what makes React components interactive.
When state changes, the component re-renders to reflect the new data.
// Using useState hook import React, { useState } from 'react';
function Counter() { const [count, setCount] = useState(0);
return ( <div> <p>Count: {count}</p> <button onClick={() => setCount(count + 1)}> Increment </button> </div> ); }