useShow in nextjs is not extracting the id from the path
my path is /blog/[id/page.tsx and it looks liek this:
'use client';
import { useShow } from '@refinedev/core';
import { IPost } from '@/classes/types';
export default function PostShow() {
const { queryResult: { data, isLoading } } = useShow<IPost>();
const postData = data?.data;
return (
<div>
{isLoading && <p>Loading...</p>}
{!isLoading && (
<><h1>{postData?.fields.title}</h1><p>{postData?.fields.description}</p></>
)}
</div>
);
}
The error I keep getting is
[useShow]: resource: "blogPost", id: undefined
If you don't use the
See https://refine.dev/docs/api-reference/core/hooks/show/useShow/#resource
'use client';
import { useShow } from '@refinedev/core';
import { IPost } from '@/classes/types';
export default function PostShow() {
const { queryResult: { data, isLoading } } = useShow<IPost>();
const postData = data?.data;
return (
<div>
{isLoading && <p>Loading...</p>}
{!isLoading && (
<><h1>{postData?.fields.title}</h1><p>{postData?.fields.description}</p></>
)}
</div>
);
}
The error I keep getting is
[useShow]: resource: "blogPost", id: undefined
If you don't use the
setShowId method to set the showId, you should pass the id prop to useShow. Otherwise, useShow will not be able to infer the id from the current URL. See https://refine.dev/docs/api-reference/core/hooks/show/useShow/#resource
