DavidHDev / react-haiku

A clean & lightweight collection of React Hooks & Utilities!
https://reacthaiku.dev/
Other
236 stars 48 forks source link
components frontend hook hooks next nextjs react react-hooks reactjs utilities

React Haiku



react-haiku

A clean & lightweight collection of React Hooks & Utilities!




NPM npm npm

Links

What is this?

Haiku is a simple & lightweight React library with the goal of saving
you time by offering a large collection of hooks & utilities that will
help you get the job done faster & more efficiently!

Install

Installing Haiku is very easy!
Requires React >=16.8.0

NPM

npm install react-haiku

Yarn

yarn add react-haiku

PNPM

pnpm install react-haiku


Unit Testing with Jest and React Testing Library

This project uses jest as the testing framework and React Testing Library (RTL) for testing React components and hooks.

Running Tests

To execute all unit tests with coverage enabled

npm run test

Usage Examples


Please check the official Documentation for full usage examples.


Using Hooks


import { useHover } from 'react-haiku';

const Component = () => {
  const { hovered, ref } = useHover();

  return <p ref={ref}>{hovered ? 'All mice on me' : 'No mice on me'}</p>;
};

export default Component;

Using Utilities


import { For } from 'react-haiku';

const Component = () => {
  const list = [{ name: 'React' }, { name: 'Haiku' }];

  render(
    <>
      <For each={list} render={(item, index) => <p>{item.name}</p>} />
    </>,
  );
};

export default Component;

Contributing

Haiku is always open to improvements and contributions, you can check the Open Issues if you want to contribute, and it's also possible to request to add your own improvements/ideas using the Feature Request template. Before contributing, please read the Contribution Guide and make sure to respect the standards! Thank you for your time!

PACKAGE CONTENTS

Hooks

Utilities

Maintainers

David Haz

License

MIT