useTimeout

Run a function after a delay that you can start again or clear.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

The message appears two seconds after the click.

APIs

useTimeout

const useTimeout = (
  callback: () => void,
  delay: number,
  options?: { autoInvoke?: boolean },
) => { start: () => void; clear: () => void }
Edit this page on GitHub