react-router-prompt
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { BlockerFunction } from 'react-router-dom'; | ||
import { BlockerFunction } from 'react-router'; | ||
declare interface InitialStateType { | ||
@@ -3,0 +3,0 @@ isActive: boolean; |
@@ -1,3 +0,3 @@ | ||
import { Blocker, BlockerFunction } from 'react-router-dom'; | ||
import { Blocker, BlockerFunction } from 'react-router'; | ||
declare function usePrompt(when: boolean | BlockerFunction): Blocker; | ||
export default usePrompt; |
import { default as React } from 'react'; | ||
import { BlockerFunction } from 'react-router-dom'; | ||
import { BlockerFunction } from 'react-router'; | ||
import { default as useConfirm } from './hooks/use-confirm'; | ||
@@ -4,0 +4,0 @@ import { default as usePrompt } from './hooks/use-prompt'; |
import { jsx as f, Fragment as m } from "react/jsx-runtime"; | ||
import { useEffect as l, useCallback as n } from "react"; | ||
import { useBlocker as p, useBeforeUnload as d } from "react-router-dom"; | ||
import { useBlocker as p, useBeforeUnload as d } from "react-router"; | ||
function k(t) { | ||
@@ -5,0 +5,0 @@ const o = p(t); |
{ | ||
"version": "0.7.2", | ||
"version": "0.8.0-beta-1", | ||
"name": "react-router-prompt", | ||
@@ -33,12 +33,2 @@ "description": "React Router Navigation Prompt for v6", | ||
], | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint src --ext .js,.jsx,.ts,.tsx", | ||
"lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix", | ||
"format": "prettier \"src/**/*.{js,jsx,ts,tsx,css,scss}\" --write", | ||
"size": "size-limit", | ||
"prepublishOnly": "yarn build", | ||
"prepare": "husky" | ||
}, | ||
"devDependencies": { | ||
@@ -64,3 +54,3 @@ "@size-limit/preset-small-lib": "^11.0.2", | ||
"react-dom": "^19.0.0", | ||
"react-router-dom": "^6.22.1", | ||
"react-router": "^7.1.1", | ||
"size-limit": "^11.0.2", | ||
@@ -74,4 +64,3 @@ "typescript": "^5.3.3", | ||
"react": ">=16.8", | ||
"react-dom": ">=16.8", | ||
"react-router-dom": ">=6.19 <7" | ||
"react-dom": ">=16.8" | ||
}, | ||
@@ -81,9 +70,17 @@ "size-limit": [ | ||
"path": "dist/react-router-prompt.js", | ||
"limit": "1.2 KB" | ||
"limit": "600 B" | ||
}, | ||
{ | ||
"path": "dist/react-router-prompt.umd.cjs", | ||
"limit": "1.2 KB" | ||
"limit": "800 B" | ||
} | ||
] | ||
} | ||
], | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint src --ext .js,.jsx,.ts,.tsx", | ||
"lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix", | ||
"format": "prettier \"src/**/*.{js,jsx,ts,tsx,css,scss}\" --write", | ||
"size": "size-limit" | ||
} | ||
} |
# react-router-prompt 🚨 | ||
> A component for the react-router 6 `Prompt`. Allows to create more flexible dialogs. | ||
> A component for the react-router 6/7 `Prompt`. Allows to create more flexible dialogs. | ||
Please follow [Note section](https://github.com/sshyam-gupta/react-router-prompt#note) for more details on react-router support | ||
[](https://www.npmjs.com/package/react-router-prompt) | ||
@@ -19,3 +21,3 @@ | ||
**React-router-dom >= 6.19** and can be used only with [**data routers**](https://reactrouter.com/en/6.8.1/routers/picking-a-router#using-v64-data-apis) | ||
**React-router-dom >= 7** or **React-router-dom >= 7** and shall be ideally used with [**data routers**](https://reactrouter.com/6.28.1/routers/picking-a-router#using-v64-data-apis) | ||
@@ -72,9 +74,12 @@ ```bash | ||
This version works with react-router-dom >=v6.19 | ||
Should be used within [data routers](https://reactrouter.com/en/6.8.1/routers/picking-a-router#using-v64-data-apis) | ||
This version works with react-router-dom >=v7 or react-router >=v7 and shall be ideally used with [**data routers**](https://reactrouter.com/6.28.1/routers/picking-a-router#using-v64-data-apis) | ||
For react-router support `(v6 - v6.2.x)` please install v0.3.0 | ||
- For react-router / react-router-dom support `(v7)` please install `v0.8.x` | ||
For react-router support (v6.7.x - v6.18.x) please install v0.5.4 | ||
- For react-router-dom support `(v6.19.x - v6.28.1)` please install `v0.7.x` | ||
- For react-router-dom support `(v6.7.x - v6.18.x)` please install `v0.5.4` | ||
- For react-router-dom support `(v6 - v6.2.x)` please install `v0.3.0` | ||
_Skipped support in middle due to breaking changes on react-router apis_ | ||
@@ -81,0 +86,0 @@ |
Sorry, the diff of this file is not supported yet
12589
1.93%2
-33.33%110
4.76%