--- title: useRequestClose description: "Dismiss the view from inside your app" --- import { Compat } from "/components/compat.jsx"; When a [view](/build/view) has run its course, dismissing it hands the user back to the conversation instead of leaving a spent panel on screen. `useRequestClose` asks the host to do that; the host owns the decision. ## Example After the order is placed, a "Done" button dismisses the confirmation and hands the shopper back to the conversation. ```tsx highlight={2,5,10} import { useState } from "react"; import { useRequestClose } from "skybridge/web"; function CheckoutConfirmation() { const requestClose = useRequestClose(); const [closing, setClosing] = useState(false); const handleDone = async () => { setClosing(true); await requestClose(); }; return (

Your order is on its way.

); } ``` ## Returns `useRequestClose` returns a single function. ### `requestClose` ```tsx requestClose(): Promise; ``` Asks the host to dismiss the current view. The promise resolves once the request is sent, not when the view closes: the host owns the decision and returns no acknowledgement, so the view cannot tell whether it was actually dismissed. Where dismissing a view fits in the view lifecycle Open the modal view you later close Request a different layout instead of closing