I wish to render a splash screen in nextjs and after 2secs I wish to navigate to certain screen but I was unable to capitalize on useEffect inside the page.tsx file in nextjs , while importing it is thowing an issue
You're importing a component that needs useEffect. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.
How can I approach and overcome this issue.Thanks in advance for your help.
2
Answers
add
"use client"
on the top of the fileThe answer lies on your error in your console, add
"use client"
on top of the page as instructed