@aboutbits/react-tooling

Tools for React

Usage no npm install needed!

<script type="module">
  import aboutbitsReactTooling from 'https://cdn.skypack.dev/@aboutbits/react-tooling';
</script>

README

React Tooling

This package includes different tools that support you with common tasks.

Table of content

Usage

First, you have to install the package:

npm install @aboutbits/react-tooling

Second, you can make use of the different tools.

useInterval

The useInterval hook calls a function at specified intervals. The code of this hook is taken from Dan Abramov's blog post.

The hook takes two parameters:

  • callback: The callback function that should be executed.
  • delay: The delay in milliseconds or null, if the interval should be paused.
import React, { useState } from 'react'
import { useInterval } from '@aboutbits/react-tooling'

const MyCommponent = () => {
  const [step, setStep] = useState(0)
  
  useInterval(() => {
    setStep(step + 1)
  }, step < 10 ? 1000 : null)

  return <p>{step}</p>
}

Build & Publish

To publish the package commit all changes and push them to main. Then run one of the following commands locally:

npm version patch
npm version minor
npm version major

Information

About Bits is a company based in South Tyrol, Italy. You can find more information about us on our website.

Support

For support, please contact info@aboutbits.it.

Credits

License

The MIT License (MIT). Please see the license file for more information.