sshyam-gupta / react-router-prompt

A replacement component for the react-router 6 `Prompt`. Allows for more flexible dialogs.

Home Page:https://codesandbox.io/s/react-router-prompt-example-react-router-6-7-y9ug7z?file=/src/App.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

export usePrompt and useConfirm hooks

Shaddix opened this issue Β· comments

Thanks for the lib!

Would you mind exporting the hooks that you have (usePrompt and useConfirm), so that it'd be possible to use them?

Hey, @Shaddix. Thank you so much for taking the time to point this out

@Shaddix Open in v0.5.4
You can use it as:

Import πŸ‘‡πŸ»

import { useConfirm, usePrompt } from "react-router-prompt";

useConfirm πŸ‘‡πŸ»

const { isActive, onConfirm, resetConfirmation } = useConfirm(when)

usePrompt πŸ‘‡πŸ»

const blocker = usePrompt(when)