I've recently started learning Next.js and I've been faced with something strange. I have this simple code:
import {useRouter} from 'next/Router';
import {Profile} from '../../components/Profile';
const JobsListingPage = () => {
const Router = useRouter();
console.log(Router.query);
return (
<div>
<h1>Job Listing Dynamic Page</h1>
<Profile />
</div>
);
}
export default JobsListingPage;
It works well and I get the result in the console. The strange part is, this code gets executed 4 times on the client side. Why really? Two first time it's empty and two last times it contains the data. Is that normal or I'm doing something wrong?
Doesn't look like a normal lifecycle.