i already "imported the next/navigation"
Im using here "const { userId } = router.query;" dont know how to solve it here is full code
her is what im trying do " const [userData, setUserData] = useState(null);
const router = useRouter();
const { userId } = router.query;
useEffect(() => {
const fetchData = async () => {
try {
if (userId) {
const user = users.find((user) => user.id === userId);
if (user) {
const enterpriseChallenges = await fetchUserSubcollection(
userId,
"Enterprise_Challenges"
);
const landscapeChallenges = await fetchUserSubcollection(
userId,
"Landscape_Challenges"
);
setUserData({
...user,
enterpriseChallenges,
landscapeChallenges
});
}
}
} catch (error) {
console.error("Error fetching user data:", error);
}
};
fetchData();
}, [userId, users]);
if (!userData) {
return <div>Loading...</div>;
}
const { id, name, email, phone, enterpriseChallenges, landscapeChallenges } =
userData;"