An open API service indexing awesome lists of open source software.

https://github.com/marsidev/react-hooks

A collection of common React hooks. Made with TypeScript.
https://github.com/marsidev/react-hooks

Last synced: 19 days ago
JSON representation

A collection of common React hooks. Made with TypeScript.

Awesome Lists containing this project

README

        


@marsidev/react-hooks


npm version
GitHub Actions status
PRs Welcome

Tested with Vitest
CI Score
Twitter Follow

## Introduction

This is a collection of common React Hooks that I use in my React projects.

Bootstraped with [antfu/starter-ts].

Inspired by [usehooks-ts], [@restart/hooks], and [@chakra-ui/hooks].

## Installation
- Using npm
```bash
npm i @marsidev/react-hooks
```

- Using pnpm
```bash
pnpm add @marsidev/react-hooks
```

- Using yarn
```bash
yarn add @marsidev/react-hooks
```

## Example
```jsx
import { useScrollY } from '@marsidev/react-hooks'
import { Header, Footer, ScrollToTop } from '~/components'

export const Layout = ({ children }) => {
const { offsetPassed } = useScrollY(400)

return (



{children}

{offsetPassed && }

)
}
```

## Available Hooks
- `useCopyElementToClipboard`
- `useCopyToClipboard`
- `useInput`
- `useRendered`
- `useSafeLayoutEffect`
- `useScrollY`
- `useWindowSize`

[antfu/starter-ts]: https://github.com/antfu/starter-ts
[usehooks-ts]: https://usehooks-ts.com
[@restart/hooks]: https://www.npmjs.com/package/@restart/hooks
[@chakra-ui/hooks]: https://github.com/chakra-ui/chakra-ui/tree/main/packages/hooks