@slynch13/useinterval

React hook for setting up an interval

Usage no npm install needed!

<script type="module">
  import slynch13Useinterval from 'https://cdn.skypack.dev/@slynch13/useinterval';
</script>

README

useinterval

React hook for setting up an interval

NPM JavaScript Style Guide

Install

npm install --save useinterval

Usage

import React, { useState } from 'react'
import { useInterval } from 'useinterval'

const App = () => {
  let [example, setExample] = useState(0)
  useInterval(() => {
    setExample(x => setExample(x + 1))
  }, 1000)
  return (
    <div>
      {example}
    </div>
  )
}
export default App

License

MIT © slynch13


This hook is created using create-react-hook.