--- title: useAsyncError new: true --- # `useAsyncError` Returns the rejection value from the nearest [``][await] component. ```tsx [4,12] import { useAsyncError, Await } from "react-router-dom"; function ErrorElement() { const error = useAsyncError(); return (

Uh Oh, something went wrong! {error.message}

); } } />; ``` See the [Deferred Data Guide][deferred] and [`` docs][await docs] for more information. [await docs]: ../components/await [deferred]: ../guides/deferred