# @hoooks/use-prevent-leave

> Ask user one more time before leaving a page for safe-termination. Useful when changes are not saved.

Latest version **1.0.2** (published 2020-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hoooks/use-prevent-leave
pnpm add @hoooks/use-prevent-leave
yarn add @hoooks/use-prevent-leave
bun add @hoooks/use-prevent-leave
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-08-10 |
| First published | 2020-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | aiden jung |
| Maintainers | aidenjung |
| Keywords | hooks, react, hoooks |

## Links

- npm: https://www.npmjs.com/package/@hoooks/use-prevent-leave
- Repository: https://github.com/YunhwanJung/hoooks
- Homepage: https://github.com/YunhwanJung/hoooks#readme
- Issues: https://github.com/YunhwanJung/hoooks/issues
- npm.io page: https://npm.io/package/@hoooks/use-prevent-leave

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-08-10
- 1.0.1 — 2020-08-10
- 1.0.0 — 2020-08-10

## README

# @hoooks/use-prevent-leave
Ask user one more time before leaving a page for safe-termination. Useful when changes are not saved.

## Installation

#### yarn
`yarn add @hoooks/use-prevent-leave`

#### npm
`npm i @hoooks/use-prevent-leave`

## Usage
```js
import React from "react";
import useTitle from "@hoooks/use-prevent-leave";

export default function App() {
  const { enablePrevent, disablePrevent } = usePreventLeave();
  return (
      <>
        <button onClick={enablePrevent}>enablePrevent</button>
        <button onClick={disablePrevent}>disablePrevent</button>
      </>
  );
}
```

### Return
|Return|Type|Description|
|------|----|-----------|
|Functions|Object|An object containing enablePrevent and disablePrevent|

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