#Why in the world can't I get query params?

10 messages · Page 1 of 1 (latest)

shell adder
#
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>
    );
}
ripe kernelBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

shell adder
dapper bobcat
#

@shell adder Are you on app router or on pages router?

shell adder
#

It only loads in the component.

#

Just the pages router.

#

@dapper bobcat

dapper bobcat
#

@shell adder The logs you get on the server are probably due to prerendering. Can you check if console.log shows anything in the browser window?