useNavigation
useNavigation
.
import { useNavigation } from "@remix-run/react";
function SomeComponent() {
const navigation = useNavigation();
navigation.state; // "idle" | "submitting" | "loading"
navigation.location; // Location being navigated to
navigation.formData; // formData being submitted
navigation.formAction; // url being submitted to
navigation.formMethod; // "GET" | "POST" | "PATCH" | "PUT" | "DELETE"
}
useNavigation().formMethod
field is lowercase without the future.v2_normalizeFormMethod
Future Flag. This is being normalized to uppercase to align with the fetch()
behavior in v2, so please upgrade your Remix v1 applications to adopt the uppercase HTTP methods.
useNavigation
docs.