ReactJsState and useState Hook

State allows components to keep track of dynamic data and re-render when that data changes. In functional components, the useState hook is used to manage state.

import React, { useState } from 'react';

function Counter() {
  const [count, setCount] = useState(0);
  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Increase</button>
    </div>
  );
}

export default Counter;