Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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