useTimeout
Executes callback
after delay
milliseconds.
- @param
callback
- A function to execute. - @param
delay
- The delay in milliseconds. - @param
options
- Configurable options. - @returns void
Example
const [showNewsletterPopup, setShowNewsletterPopup] = useState(false);
useTimeout(() => {
setShowNewsletterPopup(true);
}, 1000);
if (!showNewsletterPopup) return null;
return <aside>...</aside>