I added Console.log('Dynamic page')
in a dynamic page in NextJs, but I realise it logs twice instead of once. I moved the log function into useEffect with an empty array dependency but it still logged twice. What could be the issue here? Thank you
The code /topics/[articleId].js:
import { useRouter } from 'next/router'
import { useEffect } from "react"
import Image from "next/image"
import Link from "next/link"
import ExcitedSVG from '../../../components/reaction-icons/excited'
import HappySVG from '../../../components/reaction-icons/happy'
import InLoveSVG from '../../../components/reaction-icons/in-love'
import NotSureSVG from '../../../components/reaction-icons/not-sure'
import SillySVG from '../../../components/reaction-icons/silly'
import ArticleStyles from "../../../components/styles/article.module.css"
export default function Article(){
useEffect(()=>{
console.log('Log once'); <--- //It logs twice instead
},[])
return (
<div className={`${ArticleStyles.articlePg} pt-5`}>
Component content
</div>
)
}