useAsyncError

useAsyncError

返回最近 <Await> 组件的拒绝值。

¥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

Remix v2.17 中文网 - 粤ICP备13048890号