@fransvilhelm/hooks

A set of reusable React hooks

Usage no npm install needed!

<script type="module">
  import fransvilhelmHooks from 'https://cdn.skypack.dev/@fransvilhelm/hooks';
</script>

README

@fransvilhelm/hooks

A set of reusable hooks to use inside react components.

Installation

The package can be installed using npm or yarn or any other node package manager.

npm install @fransvilhelm/hooks
# or with yarn
yarn add @fransvilhelm/hooks

NOTE: This packages uses React Hooks and those where releases in react@16.8.0. Therefore you must use a version of react that's greater than that.

Usage

This package contains a set of named exports and no default export is provided.

// Use named imports to import a separate hook:
import { useInput, useCheckbox } from '@fransvilhelm/hooks';
// Or import everything:
import * as hooks from '@fransvilhelm/hooks';

This package is distributed as an ESM package and if you use a modern javascript bundler (eg. Webpack, Rollup or Parcel) the source code will be tree-shaked and only the hooks you use will be included in your final bundle.

Typescript

This package was originally written in Typescript and types are included by default.

Contribute

Contributions are more than welcome! But I also urge you to create your own versions. These hooks are hooks that I've found that I use a lot and therefore I started to collect them inside a repo so that I can easily use them in my projects. You should do the same!

License

MIT