Why in the world can't I get query params?
Unanswered
Brown bear posted this in #help-forum
Brown bearOP
import { useEffect } from "react";
import { useRouter } from "next/router";
export default function View() {
const router = useRouter();
const { uuid } = router.query;
console.log(uuid)
return (
<div className="flex flex-col items-center justify-center min-h-screen bg-white p-4">
<div className="w-full max-w-sm p-4 bg-[#ff2121]/80 rounded shadow-lg text-center">
<h1 className="text-xl font-bold mb-2">
Welcome to the Ticket Viewer
</h1>
<p className="text-base">
Use the route{" "}
<code className="bg-black/20 p-1 rounded">
/api/view?uuid=
</code>{" "}
to view tickets.
</p>
</div>
</div>
);
}9 Replies
Brown bearOP
Roseate Spoonbill
@Brown bear Are you on app router or on pages router?
Brown bearOP
It only loads in the component.
Just the pages router.
@Roseate Spoonbill
Roseate Spoonbill
@Brown bear The logs you get on the server are probably due to prerendering. Can you check if console.log shows anything in the browser window?
Now Tailwind isn't working with my project.