Skip to content

Commit 5415e9c

Browse files
committed
useParam fix
1 parent 6cb65db commit 5415e9c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/app/blog/[id]/loader.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
const FetchLoad = async ({ params }) => {
1+
import { LoaderFunctionArgs } from "react-router-dom";
2+
const FetchLoad = async ({ params }: LoaderFunctionArgs) => {
23
const data = await fetch(
3-
`https://jsonplaceholder.typicode.com/todos/${params.id}`,
4+
`https://jsonplaceholder.typicode.com/todos/${params.id}`
45
);
56
const json = await data.json();
67
console.log(json);

src/package/hooks/useParams.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from "react";
2-
import { useParams as useReactDomParams } from "react-router-dom";
2+
import { useParams } from "react-router-dom";
33

44
//overwrite the useParams for catchall params route
55
export const useNextParams = () => {
6-
const params = useReactDomParams();
6+
const params = useParams();
77
let updatedParams: { [key: string]: any } = params;
88

99
if (Object.values(params).length > 1) {

0 commit comments

Comments
 (0)