1.0.8 โ€ข Published 11 months ago

its-custom-hooks v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

๐Ÿ“ฆ Custom Hooks Library for React

๐Ÿ“ Overview

Custom Hooks Library for React is a comprehensive collection of reusable React hooks designed to streamline common tasks in React applications. These hooks enhance development efficiency by providing straightforward, reusable solutions for everyday patterns and functionalities in React projects.

๐Ÿš€ Features

## ๐Ÿ”„ useFetch Hook

Simplifies data fetching with automatic state management for loading, error handling, and data storage.

๐Ÿ“ฅ useGet Hook

Performs HTTP GET requests and manages response data and errors.

๐Ÿ“ค usePost Hook

Handles HTTP POST requests and manages the request lifecycle.
## ๐Ÿ”„ usePut Hook

Manages HTTP PUT requests for updating resources.

๐Ÿ—‘๏ธ useDelete Hook

Easily performs HTTP DELETE requests to remove resources.

๐Ÿ’พ useLocalStorage Hook

Manages and persists state in the browser's localStorage with ease.
## ๐Ÿ”˜ useToggle Hook

Creates a simple toggle state with a single hook.

๐Ÿ“ฆ Installation

To install the package, use npm or yarn:

npm install its-custom-hooks

or

yarn add its-custom-hooks

๐Ÿ’ป Usage

๐Ÿ“š Example Usage

Here's an example of how you might use the useFetch hook in a React component:

import React from 'react'; import { useFetch } from 'its-custom-hooks';

const MyComponent = () => { const { data, loading, error } = useFetch('https://api.example.com/data');

if (loading) return Loading...; if (error) return Error: {error.message};

return {data && {JSON.stringify(data, null, 2)}}; };

export default MyComponent;

๐Ÿ“– Hook API

Each hook provides the following API:

data: The data returned from the request or localStorage.
error: Any error encountered during the request or operation.
loading: A boolean indicating if the request or operation is in progress.

๐Ÿ› ๏ธ Development

To contribute to the library, follow these steps:

๐Ÿ”ง Clone the Repository

git clone https://github.com/AhmadFaour9/its-custom-hooks.git cd its-custom-hooks

๐Ÿ“ฆ Install Dependencies

npm install

๐Ÿงช Run Tests

npm test

๐Ÿ› ๏ธ Build the Library

npm run build

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘ค Author

Eng. Ahmad Faour

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago