Skip to content

Commit c49d87e

Browse files
Remove isActive dependency when ReactRouterPrompt's children returns. (#192)
* remove `isActive` dependency when `ReactRouterPrompt`'s `children` returns. * Update src/index.tsx Co-authored-by: Shyam Gupta <38554977+sshyam-gupta@users.noreply.github.com> --------- Co-authored-by: Shyam Gupta <38554977+sshyam-gupta@users.noreply.github.com>
1 parent 7b91685 commit c49d87e

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/index.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,16 @@ function ReactRouterPrompt({
5353
resetConfirmation()
5454
}, [beforeCancel, resetConfirmation])
5555

56-
if (isActive) {
57-
return (
58-
<>
59-
{children({
60-
isActive: true,
61-
onConfirm: onConfirmAction,
62-
onCancel: onResetAction,
63-
nextLocation: nextLocation || undefined,
64-
})}
65-
</>
66-
)
67-
}
68-
return null
56+
return (
57+
<>
58+
{children({
59+
isActive: isActive,
60+
onConfirm: onConfirmAction,
61+
onCancel: onResetAction,
62+
nextLocation: nextLocation || undefined,
63+
})}
64+
</>
65+
)
6966
}
7067

7168
export { useConfirm, usePrompt }

0 commit comments

Comments
 (0)