Skip to content

Latest commit

 

History

History
45 lines (24 loc) · 2.57 KB

README.md

File metadata and controls

45 lines (24 loc) · 2.57 KB

Practical Utils and Hooks

Welcome to the Practical Utils and Hooks repository! This repository contains a collection of practical utility functions and custom React hooks developed solely by me for personal use.

Purpose

The purpose of this repository is to provide simple and focused solutions for common tasks encountered in web development. Instead of relying on libraries with numerous features, the utilities and hooks included here aim to address specific needs efficiently.

Contents

Below are the utilities and hooks included in this repository:

  1. exportPdf Function: A function to export the content of an HTML element as a PDF file.
  2. useSwipe Hook: A custom React hook for enabling swipe functionality within a container element.
  3. useInView Hook: A custom React hook leveraging the Intersection Observer API to detect when an element becomes visible in the viewport.

Usage

All utilities and hooks provided in this repository are open for anyone to use and customize according to their requirements. They are designed to be lightweight and easy to integrate into any project.

Contribution

While these utilities and hooks are primarily developed for personal use, contributions are welcome! Feel free to suggest improvements, report issues, or submit new utilities and hooks that you find useful.

License

This repository is licensed under the MIT License. Feel free to use the code in your own projects, modify it as needed, and share it with others.


exportPdf Function

The exportPdf function is designed to export the content of an HTML element as a PDF file.

useSwipe Hook

The useSwipe hook is a custom React hook for enabling swipe functionality within a container element. It allows users to swipe horizontally within the container to scroll its content.

useInView Hook

The useInView hook uses the Intersection Observer API to efficiently detect when an element becomes visible within the viewport. This can be particularly useful for triggering animations, loading content lazily, or executing any other action that depends on the visibility of elements.

useMouseSide Hook

The useMouseSide hook is a custom React hook designed to determine which side (left or right) of a specified element the mouse is currently hovering over. By utilizing this hook, developers can easily implement dynamic UI/UX effects based on the mouse's position relative to an element. This could include visual feedback, animations, or other interactive elements. The hook provides a simple and efficient way to enhance user interaction within your application.