Skip to content

A group of reusable custom hooks for making react developer life easier. The library will be auto published to npm and GitHub registries by GitHub Actions.

License

Notifications You must be signed in to change notification settings

vincecao/use-tools

Repository files navigation

A group of reusable custom hooks for making react developer life easier.

npm version npm checks

Hooks Description
usePromiseState Retrieving data from a remote by a promise function and use it like useState.
useTimeout Connecting setTimeout into React state world.
useShuffle A hook returns a new shuffled list for each unique given array.
useFetch A convenient wrapper for $fetch function. React implementation of useLazyFetch from Nuxt3 API.
useAppearance A hook as well as its provider allow you to override or reset current appearance based on system preference.
useStickyRef One reusable hook for returning a sticky boolean flag based on designated gate element window position.

Example

Please check more examples at below links

Installation

# Install latest package
# npm
npm i @vincecao/use-tools
# yarn
yarn add @vincecao/use-tools

# Install beta package
# npm
npm i @vincecao/use-tools@beta
# yarn
yarn add @vincecao/use-tools@beta

This package is automatically published in NPMJS and GITHUB npm registry.

To install package from Github npm registry, add below file in your repo before run npm i or yarn add.

# .npmrc
@vincecao:registry=https://npm.pkg.github.com

You can also install directly from current repo master

# npm
npm i vincecao/use-tools
npm i github:vincecao/use-tools

# yarn
yarn add vincecao/use-tools
yarn add github:vincecao/use-tools

Release Method

  • When a Pull Request is merged to the master, Github Actions will create and publish a beta version.
  • When a Release is created with a new tag version, Github Actions will create and publish a stable version.

Running live example

yarn
yarn start

cd example
yarn
yarn start

About

A group of reusable custom hooks for making react developer life easier. The library will be auto published to npm and GitHub registries by GitHub Actions.

Topics

Resources

License

Stars

Watchers

Forks

Packages