useAsyncError
useAsyncError
从最近的 <Await> 组件返回拒绝值。
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 />}/>;其他资源
指南
API