Currently, I am navigating on
http://localhost:3000/?groupId=chicago&dayOfWeek=tuesday
. Despite pressing a button on a component, the desired outcome of transitioning to another day, like Thursday, is not occurring.
import { useRouter, usePathname, useSearchParams } from "next/navigation";
const SelectDayDialog = ({ groupId, organization }) => {
const router = useRouter();
const thursday = "Thursday";
const handleGroupSelection = (dayOfWeek) => {
const query = { groupId: groupId, dayOfWeek: dayOfWeek.toLowerCase() };
const queryString = new URLSearchParams(query).toString();
let routeUrl = `/?${queryString}`;
router.push(routeUrl);
};
return (
<div>
<button onClick={() => handleGroupSelection(thursday)}>Thursday</button>
</div>
);
};
Upon clicking the button, the url transitions to
http://localhost:3000/?groupId=chicago&dayOfWeek=thursday
. However, there is no update in the page content or components.
How can I resolve this issue?