Dynamic route doesn't have params #2217
Closed
andriiradkevych
started this conversation in
General
Replies: 1 comment
|
The async function MyPage(req: Request, ctx: RouteContext) {}Applying this to your code: - import { PageProps } from '$fresh/server.ts';
+ import { RouteContext } from '$fresh/server.ts';
import PostPage from 'components/Pages/Post/index.tsx';
- const Post = async (props: PageProps) => {
- console.log(props.params);
+ const Post = async (req: Request, ctx: RouteContext) => {
+ console.log(ctx.params);
return <PostPage data={data} />;
};
export default Post;It's one of my regrets to match the syntax with middlewares instead of sync components because naturally folks add the |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
routes/[pageSlug].tsx
Created dynamic route , and try to get param by url
localhost:3000/something, butprops.paramsreturnundefined, what can be the reason ?All reactions