Skip to content

Commit 65bbc09

Browse files
authored
Clearly describe API of callback in code (#7279)
* Clearly describe API of callback in code * fix syntax error
1 parent e632747 commit 65bbc09

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/react-router/docs/api/Prompt.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ Will be called with the next `location` and `action` the user is attempting to n
2323

2424
```jsx
2525
<Prompt
26-
message={location =>
27-
location.pathname.startsWith("/app")
26+
message={(location, action) => {
27+
if (action === 'POP') {
28+
console.log("Backing up...")
29+
}
30+
31+
return location.pathname.startsWith("/app")
2832
? true
2933
: `Are you sure you want to go to ${location.pathname}?`
30-
}
34+
}}
3135
/>
3236
```
3337

0 commit comments

Comments
 (0)