{"id":15893106,"url":"https://github.com/bezzubovegor/react-router-navigation-confirm","last_synced_at":"2025-11-04T22:02:51.658Z","repository":{"id":34078832,"uuid":"167549590","full_name":"BezzubovEgor/react-router-navigation-confirm","owner":"BezzubovEgor","description":"A collection of components to display a custom confirmation dialog on navigation. More flexible solution to prevent than default react-router 'Prompt'","archived":false,"fork":false,"pushed_at":"2024-12-14T02:38:37.000Z","size":14991,"stargazers_count":8,"open_issues_count":25,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-17T18:07:14.398Z","etag":null,"topics":["dialog","getuserconfirmation","modal","prompt","react","react-confirm","react-navigation-prompt","react-prompt","react-router","router","user"],"latest_commit_sha":null,"homepage":"https://bezzubovegor.github.io/react-router-navigation-confirm","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BezzubovEgor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-25T13:13:01.000Z","updated_at":"2024-11-08T16:36:55.000Z","dependencies_parsed_at":"2023-12-18T05:29:09.857Z","dependency_job_id":"2a9aa451-bb92-42bc-b35d-f8ffbc712e83","html_url":"https://github.com/BezzubovEgor/react-router-navigation-confirm","commit_stats":{"total_commits":174,"total_committers":5,"mean_commits":34.8,"dds":0.6896551724137931,"last_synced_commit":"15e8a8daddf9fa6343a2eb37b5531de8d94cf590"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/BezzubovEgor/react-router-navigation-confirm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BezzubovEgor%2Freact-router-navigation-confirm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BezzubovEgor%2Freact-router-navigation-confirm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BezzubovEgor%2Freact-router-navigation-confirm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BezzubovEgor%2Freact-router-navigation-confirm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BezzubovEgor","download_url":"https://codeload.github.com/BezzubovEgor/react-router-navigation-confirm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BezzubovEgor%2Freact-router-navigation-confirm/sbom","scorecard":{"id":21640,"data":{"date":"2025-08-11","repo":{"name":"github.com/BezzubovEgor/react-router-navigation-confirm","commit":"15e8a8daddf9fa6343a2eb37b5531de8d94cf590"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build-test-deploy.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:63: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:83: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:90: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/build-test-deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:75: update your workflow using https://app.stepsecurity.io/secureworkflow/BezzubovEgor/react-router-navigation-confirm/publish.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:71","Info:   0 out of  19 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   2 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"74 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8mmm-9v2q-x3f9","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-4www-5p9h-95mh","Warn: Project is vulnerable to: GHSA-9gqv-wp59-fq42","Warn: Project is vulnerable to: GHSA-33f9-j839-rf8h","Warn: Project is vulnerable to: GHSA-c36v-fmgq-m8hx","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-3949-f494-cm99","Warn: Project is vulnerable to: GHSA-x7hr-w5r2-h6wg","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T16:54:18.273Z","repository_id":34078832,"created_at":"2025-08-14T16:54:18.273Z","updated_at":"2025-08-14T16:54:18.273Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282720756,"owners_count":26716064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-04T02:00:05.887Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dialog","getuserconfirmation","modal","prompt","react","react-confirm","react-navigation-prompt","react-prompt","react-router","router","user"],"created_at":"2024-10-06T08:07:33.994Z","updated_at":"2025-11-04T22:02:51.639Z","avatar_url":"https://github.com/BezzubovEgor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#\r\n\r\n\u003cp align=\"center\"\u003e\r\n    \u003ca href=\"https://bezzubovegor.github.io/react-router-navigation-confirm\"\u003e\r\n        \u003cimg src=\"https://bezzubovegor.github.io/react-router-navigation-confirm/logo.png\" width=\"120\" title=\"RRNC\" alt=\"RRNC\"/\u003e\r\n    \u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n\u003ch2 align=\"center\"\u003e\r\n  React Router Navigation Confirm\r\n\u003c/h2\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n    \u003ca href=\"https://travis-ci.com/BezzubovEgor/react-router-navigation-confirm\"\u003e\r\n        \u003cimg src=\"https://travis-ci.com/BezzubovEgor/react-router-navigation-confirm.svg?branch=master\" alt=\"Build Status\"/\u003e\r\n    \u003c/a\u003e\r\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\r\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" alt=\"License: MIT\"/\u003e\r\n    \u003c/a\u003e\r\n    \u003ca href=\"https://codecov.io/gh/BezzubovEgor/react-router-navigation-confirm\"\u003e\r\n        \u003cimg src=\"https://codecov.io/gh/BezzubovEgor/react-router-navigation-confirm/branch/master/graph/badge.svg?token=XAhNiBN2e9\" alt=\"codecov\"/\u003e\r\n    \u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n## Table of Contents\r\n\r\n- [Table of Contents](#table-of-contents)\r\n- [Installation](#installation)\r\n- [Demo](#demo)\r\n- [General Usage](#general-usage)\r\n  - [Basic example](#basic-example)\r\n  - [Custom dialog](#custom-dialog)\r\n- [API](#api)\r\n  - [**1. `\u003cHistoryListener/\u003e`**](#1-historylistener)\r\n  - [**2. `\u003cNavigationConfirm/\u003e`**](#2-navigationconfirm)\r\n  - [**3. `\u003cNavigationConfirmModal/\u003e`**](#3-navigationconfirmmodal)\r\n- [License](#license)\r\n\r\n## Installation\r\n\r\nTo install this component you can use [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/):\r\n\r\n    $ npm install --save react-router-navigation-confirm\r\n    $ yarn add react-router-navigation-confirm\r\n\r\n## Demo\r\n\r\nYou can see demo and docs on this [site](https://bezzubovegor.github.io/react-router-navigation-confirm).\r\n\r\n## General Usage\r\n\r\n### Basic example\r\n\r\nTo show confirmation dialog on every navigation you only need to include `\u003cHistoryListener/\u003e` provider-component to the root router of your app and `\u003cNavigationConfirmModal/\u003e` to any Route (inside `\u003cHistoryListener\u003e`) in which you want to display confirmation dialog:\r\n\r\n```jsx\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport { BrowserRouter } from 'react-router-dom';\r\nimport { NavigationConfirmModal, HistoryListener } from 'react-router-navigation-confirm';\r\n\r\nimport App from './App';\r\n\r\n\r\nReactDOM.render(\r\n    \u003cBrowserRouter\u003e\r\n        \u003cdiv\u003e\r\n            \u003cHistoryListener\u003e\r\n                \u003cNavigationConfirmModal/\u003e\r\n            \u003cHistoryListener/\u003e\r\n            \u003cApp /\u003e\r\n        \u003c/div\u003e\r\n    \u003c/BrowserRouter\u003e\r\n    , document.getElementById('root')\r\n);\r\n```\r\n\r\n1. `HistoryListener` - the component-provider which start to listen all changes of history and help to understand when you go forward and when you go back in the navigation(`NavigationConfirmModal` and `NavigationConfirm` will not work without HistoryListener).\r\n\r\n2. `NavigationConfirmModal` - the component that displays confirmation dialog with to buttons (*Confirm* and *Cancel*) when you try to navigate to other page or Route.\r\n\r\n### Custom dialog\r\n\r\nIf you want to create custom dialog you can use `NavigationConfirm` confirm component:\r\n\r\n```js\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport { BrowserRouter } from 'react-router-dom';\r\nimport { NavigationConfirm, HistoryListener } from 'react-router-navigation-confirm';\r\n\r\nimport App from './App';\r\n\r\nconst children = ({ onConfirm, onCancel }) =\u003e (\r\n    \u003cdiv\u003e\r\n        \u003cbutton onClick={ onConfirm }\u003eConfirm\u003c/button\u003e\r\n        \u003cbutton onClick={ onCancel }\u003eCancel\u003c/button\u003e\r\n    \u003c/div\u003e\r\n)\r\n\r\n\r\nReactDOM.render(\r\n    \u003cBrowserRouter\u003e\r\n        \u003cdiv\u003e\r\n            \u003cHistoryListener\u003e\r\n                \u003cNavigationConfirm\u003e\r\n                    { children }\r\n                \u003c/NavigationConfirm\u003e\r\n            \u003c/HistoryListener\u003e\r\n            \u003cApp /\u003e\r\n        \u003c/div\u003e\r\n    \u003c/BrowserRouter\u003e\r\n    , document.getElementById('root')\r\n);\r\n\r\n```\r\n\r\n`NavigationConfirm` is the component that displays custom children, you should provide function that takes object with `onConfirm` and `onCancel` and return some React element. You can use `onConfirm` to approve navigation ot `onCancel` function to reject it and stay on the same page / Route.\r\n\r\n## API\r\n\r\n### **1. `\u003cHistoryListener/\u003e`**\r\n\r\n| Property | Description | Default | Type | Required |\r\n|:---|:---|:---|:---|:---|\r\n| `children` | React element / node to render into the `HistoryListener` component | `undefined` | `React.ReactNode` | *false* |\r\n\r\n### **2. `\u003cNavigationConfirm/\u003e`**\r\n\r\n| Property | Description | Default | Type | Required |\r\n|:---|:---|:---|:---|:---|\r\n|`children` | function that takes object with `onConfirm` and `onCancel` fields-functions and returns React node to render when user navigate to other page / Route| *no default* | `({ onConfirm: function, onCancel: function }) =\u003e React.ReactNode;` | *true* |\r\n|`unloadMsg` | message to show in the confirmation dialog on page unload event (in new versions in browser message alwase takes default messges according browser) | `'msg'` | `string` | *false* |\r\n|`when` | condition to render confirmation, you can hide or show dialog by pass `true` or `false`, or create custom behaviour using function | `true` | `boolean | ((location: Location, routeProps: RouteComponentProps) =\u003e boolean)` | *false* |\r\n\r\n### **3. `\u003cNavigationConfirmModal/\u003e`**\r\n\r\n| Property | Description | Default | Type | Required |\r\n|:---|:---|:---|:---|:---|\r\n|`children` | React element / node to render into the `NavigationConfirmModal` component | `'Are you sure you want to leave this page?'` | `React.ReactNode` | *false* |\r\n|`when` | condition to render confirmation, you can hide or show dialog by pass `true` or `false`, or create custom behaviour using function | `true` | `boolean | ((location: Location, routeProps: RouteComponentProps) =\u003e boolean)` | *false* |\r\n|`onCancel` | function to call when user click on cancel button | `undefined` | `() =\u003e void` | *false* |\r\n|`onConfirm` | function to call when user click on confirm button | `undefined` | `() =\u003e void` | *false* |\r\n|`confirmText` | Text for confirm button | `'Confirm'` | `string` | *false* |\r\n|`cancelText` | Text for cancel button | `'Cancel'` | `string` | *false* |\r\n|`modalClassName` | modal class name | `'nc-modal'` | `string` | *false* |\r\n|`backdropClassName` | class name for modal backdrop | `'nc-modal__backdrop'` | `string` | *false* |\r\n|`contentClassName` | content class name | `'nc-modal__content'` | `string` | *false* |\r\n|`bodyClassName` | class name for body container | `'nc-modal__body'` | `string` | *false* |\r\n|`footerClassName` | class name for modal footer | `'nc-modal__footer'` | `string` | *false* |\r\n|`buttonClassName` | class name for all modal buttons (applyed for confirm and cancel) | `'nc-modal__button'` | `string` | *false* |\r\n|`buttonConfirmClassName` | confirm button aditional style | `'confirm'` | `string` | *false* |\r\n\r\n## License\r\n\r\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezzubovegor%2Freact-router-navigation-confirm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbezzubovegor%2Freact-router-navigation-confirm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezzubovegor%2Freact-router-navigation-confirm/lists"}