Next.js Discord

Discord Forum

how to hide query parameters

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Avatar
Barbary LionOP
I am on next js 14.2 where I want to pass query to child page but want to hide in url
I have used as on Link like this

<Link
                                            key={index}
                                            prefetch={true}
                                            href={{
                                                pathname: `/project/client-projects/${clientProject.project_id}`,
                                                query: {
                                                    projectId: clientProject.project_id,
                                                    workId: clientProject.work_id
                                                }
                                            }}
                                            as={`/project/client-projects/${formatTitle(clientProject.project_title)}`}


this works but on the child page i am using searchparams which is not able to decode

child code

export default function Overview({ searchParams }: any) {
    useEffect(() => {
        getProjectDetailsApi({
            "project_id": searchParams["projectId"],
            "work_id": searchParams["workId"]
        }).then((value: GetProjectDetailsModel) => {
            setApiResponse(value)
        })
    })

1 Reply

Avatar
Barbary LionOP
done