Settimeout React Hook

Simple hook to use Settimeout with

Mon, 27 Jun 2022
import { useEffect } from "react";

export default function App() {
  useEffect(() => {
    const timer = setTimeout(() => console.log("Timer Finished!"), 5000);
    return () => clearTimeout(timer);
  }, []);

  return <p>Test</p>
Buy Me A CoffeeDigitalOcean Referral Badge
Edward Beazer

Edward Beazer - I just like to build shit. Sometimes I get stuck for hours, even days while trying to figure out how to solve an issue or implement a new feature. Hope my tips and tutorials can save you some time.

DigitalOcean Referral Badge