diff --git a/.changeset/normalize-form-method.md b/.changeset/normalize-form-method.md new file mode 100644 index 0000000000..e781bf8a20 --- /dev/null +++ b/.changeset/normalize-form-method.md @@ -0,0 +1,7 @@ +--- +"react-router": minor +"react-router-dom": minor +"@remix-run/router": minor +--- + +Add `future.v7_normalizeFormMethod` flag to normalize exposed `useNavigation().formMethod` and `useFetcher().formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior diff --git a/docs/routers/create-browser-router.md b/docs/routers/create-browser-router.md index 433354249e..6126de6499 100644 --- a/docs/routers/create-browser-router.md +++ b/docs/routers/create-browser-router.md @@ -47,6 +47,8 @@ function createBrowserRouter( routes: RouteObject[], opts?: { basename?: string; + future?: FutureConfig; + hydrationData?: HydrationState; window?: Window; } ): RemixRouter; diff --git a/docs/routers/create-memory-router.md b/docs/routers/create-memory-router.md index 2b5c24148a..60103b2a83 100644 --- a/docs/routers/create-memory-router.md +++ b/docs/routers/create-memory-router.md @@ -52,9 +52,10 @@ function createMemoryRouter( routes: RouteObject[], opts?: { basename?: string; + future?: FutureConfig; + hydrationData?: HydrationState; initialEntries?: InitialEntry[]; initialIndex?: number; - window?: Window; } ): RemixRouter; ``` diff --git a/packages/react-router-dom/dom.ts b/packages/react-router-dom/dom.ts index a87ff65715..6a01100aff 100644 --- a/packages/react-router-dom/dom.ts +++ b/packages/react-router-dom/dom.ts @@ -1,8 +1,8 @@ -import type { FormEncType, FormMethod } from "@remix-run/router"; +import type { FormEncType, HTMLFormMethod } from "@remix-run/router"; import type { RelativeRoutingType } from "react-router"; -export const defaultMethod = "get"; -const defaultEncType = "application/x-www-form-urlencoded"; +export const defaultMethod: HTMLFormMethod = "get"; +const defaultEncType: FormEncType = "application/x-www-form-urlencoded"; export function isHtmlElement(object: any): object is HTMLElement { return object != null && typeof object.tagName === "string"; @@ -110,7 +110,7 @@ export interface SubmitOptions { * The HTTP method used to submit the form. Overrides `