Anuragtech02 / useReactHooks

useReactHooks is a curated list of custom react hooks that will benefit people in their daily tasks related to development in react.
MIT License
47 stars 17 forks source link
hacktoberfest hacktoberfest2022 hooks reactjs

useReactHooks

A repository for custom React Hooks.

npm-build-react typescript

Table of contents

What is useReactHooks

useReactHooks is a curated list of custom react hooks that will benefit people in their daily tasks related to development in react.

Pre-Requisites

Git and Github

Here are some instructions on how to setup git. youtube-git

React (Typescript)

React is a free and open-source front-end JavaScript library for building user interfaces or UI components. It is maintained by Facebook and a community of individual developers and companies. It allows you to create single page applications which can change state without having to reload the page.

What are React hooks?
Hooks are functions that let you “hook into” React state and lifecycle features from function components. They let you use state and other React features without writing a class. Any function that starts with the keyword use is considered to be a hook in react. Here's very good article by FreeCodeCamp on react hooks.

Why Typescript?
Typescript has gained immense popularity over the past few years, mainly because of improved code consistency, less proneness to errors and future browser support. Since the motive of the repostiry is to create hooks or in simple terms functional components, we needed type checking for better readability and understanding of the functions and props. Additionally it also provides better support for JSX and incredible intellisense in modern text editors.

You can learn about React and React Typescript from here.

How to contribute

We're open to any kind of contribution, just follow the guidelines and you're good to go!

Issues

Code Contribution

Fork

Fork the repository on your account by clicking on the fork button on the top right corner of the repository.
fork

Clone the fork

Clone setup the repository on your local machine using this command
$ git clone git@github.com:[your_github_handle]/useReactHooks.git && cd useReactHooks
You might also need to generate a Personal Access Token due to new rules by Github. Here's how to generate a Personal Access Token in case you don't know.

Installing Dependencies

Once you're inside the directory, run the following command to install all the dependencies and run the project.

Creating custom hook

Your hook would look something like this

interface MagicType {
  type1: string,
  type2: number,
  ...
}

export function useMagicHook(): MagicType {
  // this custom hook does some serious magic

  return magic;
}

Submitting a PR

Our Awesome Contributors

Made with contributors-img.