Skip to content

Commit 61e86da

Browse files
docs: remove "add type support" section in middleware doc (#14034)
1 parent 11e1db8 commit 61e86da

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

docs/how-to/middleware.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,7 @@ export default {
4141

4242
<docs-warning>By enabling the middleware feature, you change the type of the `context` parameter to your loaders and actions. Please pay attention to the section on [getLoadContext](#custom-server-with-getloadcontext) below if you are actively using `context` today.</docs-warning>
4343

44-
### 2. Add type support
45-
46-
Update your `app/types/global.d.ts` to enable middleware types:
47-
48-
```ts filename=app/types/global.d.ts
49-
declare module "@react-router/dev/routes" {
50-
interface AppConfig {
51-
future: {
52-
unstable_middleware: true;
53-
};
54-
}
55-
}
56-
```
57-
58-
### 3. Create a context
44+
### 2. Create a context
5945

6046
Create type-safe context objects using `unstable_createContext`:
6147

@@ -67,7 +53,7 @@ export const userContext =
6753
unstable_createContext<User | null>(null);
6854
```
6955

70-
### 4. Export middleware from your routes
56+
### 3. Export middleware from your routes
7157

7258
```tsx filename=app/routes/dashboard.tsx
7359
import { redirect } from "react-router";

0 commit comments

Comments
 (0)