main
Branches
main (2.15.1)dev
Versions
2.15.11.19.3v0.21.0
React Router v7 has been released. View the docs
useAsyncError

useAsyncError

Returns the rejection value from the closest <Await> component.

import { Await, useAsyncError } from "@remix-run/react";

function ErrorElement() {
  const error = useAsyncError();
  return (
    <p>Uh Oh, something went wrong! {error.message}</p>
  );
}

<Await
  resolve={promiseThatRejects}
  errorElement={<ErrorElement />}
/>;

Additional Resources

Guides

API

Docs and examples licensed under MIT