-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generics for loader data, action data, and fetchers (#12180)
- Loading branch information
1 parent
49ffd53
commit 5c7cc02
Showing
7 changed files
with
72 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
"react-router": major | ||
--- | ||
|
||
Migrate Remix type generics to React Router | ||
|
||
- These generics are provided for Remix v2 migration purposes | ||
- These generics and the APIs they exist on should be considered informally deprecated in favor of the new `Route.*` types | ||
- Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the `Route.*` types | ||
- For React Router v6 users, these generics are new and should not impact your app, with one exception | ||
- `useFetcher` previously had an optional generic (used primarily by Remix v2) that expected the data type | ||
- This has been updated in v7 to expect the type of the function that generates the data (i.e., `typeof loader`/`typeof action`) | ||
- Therefore, you should update your usages: | ||
- ❌ `useFetcher<LoaderData>()` | ||
- ✅ `useFetcher<typeof loader>()` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters