react usetimeout code example

Example 1: settimeout in react

useEffect(() => {
   const timeout = setTimeout(() => {
      history.push('/dashboard');
    }, 3000);
  },[]);

Example 2: react timeout function

useEffect(() => {
  const timer = setTimeout(() => {
    console.log('This will run after 1 second!')
  }, 1000);
  return () => clearTimeout(timer);
}, []);

Example 3: callout react

<div class="ms-CalloutExample">
  <div class="ms-Callout is-hidden">
    <div class="ms-Callout-main">
      <div class="ms-Callout-header">
        <p class="ms-Callout-title">All of your favorite people</p>
      </div>
      <div class="ms-Callout-inner">
        <div class="ms-Callout-content">
          <p class="ms-Callout-subText">Message body is optional. If help documentation is available, consider adding a link to learn more at the bottom.</p>
        </div>
        <div class="ms-Callout-actions">
          <a class="ms-Link">Learn more</a> 
        </div>
      </div>
    </div>
  </div>
  <div class="ms-CalloutExample-button">
    <button class="ms-Button">
      <span class="ms-Button-label">Open Callout</span> 
    </button>
  </div>
</div>