Function useTimeout

  • Returns the protocol that delays invoking a callback until after a timeout.

    The delayed invocation is automatically cancelled on unmount.

    The timeout should be started/stopped after the component is mounted. Before that, it is a no-op.

    Returns [schedule: Schedule, cancel: (() => void)]