main
Branches
main (2.15.2)dev
Versions
2.15.21.19.3v0.21.0
React Router v7 has been released. View the docs
useRouteError

useRouteError

Accesses the error thrown during an action, loader, or rendering to be used in an ErrorBoundary.

export function ErrorBoundary() {
  const error = useRouteError();
  return <div>{error.message}</div>;
}

Additional Resources

Guides

API Reference

Docs and examples licensed under MIT