How to use @rooks/use-interval - 1 common examples

To help you get started, we’ve selected a few @rooks/use-interval examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imbhargav5 / rooks / packages / storybook / src / interval.js View on Github external
function UseIntervalDemo() {
  const [value, dispatcher] = useReducer(reducer, { count: 0 });

  function increment() {
    dispatcher({
      type: "increment"
    });
  }

  const { start, stop } = useInterval(() => {
    increment();
  }, 1000);

  return (
    <>
      <p>value is {value.count}</p>
      <button>Start</button>
      <button>Stop</button>
    
  );
}

@rooks/use-interval

A react hook for using setInterval

MIT
Latest version published 4 years ago

Package Health Score

56 / 100
Full package analysis

Popular @rooks/use-interval functions