useFormAction
解析 URL 為元件階層中最接近的路由,而不是應用程式的目前 URL。
這在內部由 <Form>
使用,將動作解析為最接近的路由,但也可以作為一般用途使用。
import { useFormAction } from "@remix-run/react";
function SomeComponent() {
// closest route URL
const action = useFormAction();
// closest route URL + "destroy"
const destroyAction = useFormAction("destroy");
}
useFormAction(action, options)
action
選用。要附加到最接近的路由 URL 的動作。
options
唯一的選項是 { relative: "route" | "path"}
。
..
將刪除一個 URL 區段。