vituarvom / react-smart-utils

A simple, smart hooks and utility functions to make development easier
https://www.npmjs.com/package/react-smart-utils
13 stars 34 forks source link

Implement useTimeout hook #19

Open bharat-dussa opened 2 months ago

bharat-dussa commented 2 months ago

useTimeout

Description: A hook for managing timeouts, allowing you to execute a function after a specified delay. This is useful for delaying actions like hiding UI elements or triggering events.

Parameters:

Returns:

Example:


import { useTimeout } from 'your-library';

const ExampleComponent = () => {
  const [visible, setVisible] = useState(true);
  const { start, clear } = useTimeout(() => setVisible(false), 3000);

  return (
    <div>
      <button onClick={start}>Hide after 3 seconds</button>
      <button onClick={clear}>Cancel Timeout</button>
      {visible && <p>This will disappear after 3 seconds</p>}
    </div>
  );
};
nikkivaddepelli commented 2 months ago

@bharat-dussa I would like to work on this issue. Can you please assign this to me?

doosabhulaxmi commented 2 months ago

@bharat-dussa hi i want to slove this issue please assign

bharat-dussa commented 2 months ago

Okay

shirishabolli commented 1 month ago

plz assign me this issue