Skip to content

Commit

Permalink
Clearly describe API of callback in code (#7279)
Browse files Browse the repository at this point in the history
* Clearly describe API of callback in code

* fix syntax error
  • Loading branch information
kylemh committed Apr 23, 2020
1 parent e632747 commit 65bbc09
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/react-router/docs/api/Prompt.md
Expand Up @@ -23,11 +23,15 @@ Will be called with the next `location` and `action` the user is attempting to n

```jsx
<Prompt
message={location =>
location.pathname.startsWith("/app")
message={(location, action) => {
if (action === 'POP') {
console.log("Backing up...")
}

return location.pathname.startsWith("/app")
? true
: `Are you sure you want to go to ${location.pathname}?`
}
}}
/>
```

Expand Down

0 comments on commit 65bbc09

Please sign in to comment.