@byungi/react-router-prompt
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

react-router-prompt 🚨

NPM version NPM downloads

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

🏠 Homepage

Demo

Install

yarn add react-router-prompt

Usage

<ReactRouterPrompt when={isDirty}>
  {({ isActive, onConfirm, onCancel }) => (
    <Modal show={isActive}>
      <div>
        <p>Do you really want to leave?</p>
        <button onClick={onCancel}>Cancel</button>
        <button onClick={onConfirm}>Ok</button>
      </div>
    </Modal>
  )}
</ReactRouterPrompt>

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Credits

📝 License

Copyright © 2022 Shyam Gupta (shyamm@outlook.com).
This project is MIT licensed.

Author

👤 Shyam Gupta (shyamm@outlook.com)

Dependencies (0)

    Dev Dependencies (14)

    Package Sidebar

    Install

    npm i @byungi/react-router-prompt

    Weekly Downloads

    3

    Version

    0.3.1

    License

    MIT

    Unpacked Size

    87 kB

    Total Files

    23

    Last publish

    Collaborators

    • skt-t1-byungi