# @hhgtech/hooks

> Hello Health Group's Custom Hooks for React.

Latest version **0.0.25** (published 2024-06-04) · 0 weekly downloads

## Install

```sh
npm install @hhgtech/hooks
pnpm add @hhgtech/hooks
yarn add @hhgtech/hooks
bun add @hhgtech/hooks
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.25 |
| Published | 2024-06-04 |
| First published | 2023-08-01 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 51.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tung.vu, hhg_admin_dev |

## Links

- npm: https://www.npmjs.com/package/@hhgtech/hooks
- npm.io page: https://npm.io/package/@hhgtech/hooks

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^17.0.0 || ^18.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [@hhgtech/utils](https://npm.io/package/@hhgtech/utils.md) ^0.0.14

## Recent versions

- 0.0.25 (latest) — 2024-06-04
- 0.0.24 — 2023-11-10
- 0.0.23 — 2023-11-10
- 0.0.22 — 2023-11-09
- 0.0.21 — 2023-11-09
- 0.0.20 — 2023-11-09
- 0.0.19 — 2023-11-09
- 0.0.18 — 2023-11-09
- 0.0.17 — 2023-11-09
- 0.0.16 — 2023-11-09
- 0.0.15 — 2023-11-07
- 0.0.14 — 2023-11-07
- 0.0.13 — 2023-11-07
- 0.0.12 — 2023-11-07
- 0.0.11 — 2023-11-07
- … 9 more at https://npm.io/package/@hhgtech/hooks/versions

## README

# @hhgtech/hooks

Hello Health Group's Custom Hooks for React.

## Installation

You can install this plugin using npm or yarn:

```bash
npm install @hhgtech/hooks
```

or

```bash
yarn add @hhgtech/hooks
```

## Hooks

### `useAppHeight`

This hook set app height to css variable `--app-height`

**Usage:**

```JSX
import { useAppHeight } from '@hhgtech/hooks';

const App = () => {
  const appHeight = useAppHeight();

  return (
    <div style={{ height: 'var(--app-height, 100vh)' }}>
      {/* ... */}
    </div>
  );
};
```

### `useDragScroll`

A hook that enables horizontal scrolling of a container element by dragging with the mouse.

**Returns:**

An object containing the following properties:

- `sliding`: A boolean indicating whether the user is currently dragging the container.
- `mouseDownHandler`: A function to be attached to the `onMouseDown` event of the container element.
- `sliderRef`: A ref to the container element.
- `pos`: A ref to an object containing the initial position of the mouse and the container when click on container.

**Usage:**

```JSX
  const { sliding, mouseDownHandler, sliderRef } = useDragScroll();
  return (
    <div ref={sliderRef} onMouseDown={mouseDownHandler}>
      {sliding ? 'Dragging...' : 'Not dragging.'}
    </div>
  );
```

### `useIsMobile`

A hook that returns a boolean indicating whether the current device is mobile or not.

**Parameters:**

isMobileSsr - A boolean indicating whether the device is mobile on server-side rendering.

**Returns:**

A boolean indicating whether the current device is mobile or not.

**Usage:**

```JSX
const isMobile = useGetIsMobile(false);
console.log(isMobile); // false
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---
_Source: https://npm.io/package/@hhgtech/hooks · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
