Skip to content

Commit

Permalink
docs: Slightly improve navigation-blocking.md to avoid confusion (Tan…
Browse files Browse the repository at this point in the history
  • Loading branch information
reihwald authored Dec 15, 2024
1 parent 437fb74 commit f063b49
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/framework/react/guide/navigation-blocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,26 @@ function MyComponent() {
return false
}

const shouldLeave = new Promise<boolean>((resolve) => {
const shouldBlock = new Promise<boolean>((resolve) => {
// Using a modal manager of your choice
modals.open({
title: 'Are you sure you want to leave?',
children: (
<SaveBlocker
confirm={() => {
modals.closeAll()
resolve(true)
resolve(false)
}}
reject={() => {
modals.closeAll()
resolve(true)
}}
/>
),
onClose: () => resolve(false),
onClose: () => resolve(true),
})
})
return !shouldLeave
return shouldBlock
},
})

Expand Down

0 comments on commit f063b49

Please sign in to comment.