Next.js Discord

Discord Forum

not utilizing next.js features: using “use client”, useEffect feels wrong…

Unanswered
Singapura posted this in #help-forum
Open in Discord
Avatar
SingapuraOP
I think i have to do a big code refactoeing and change my approach. I feel like i shouldnt be using useEffect for my async functions.

Ive seen codes where people use await and then make the Home component an async component but when i tried it says prisma client cant run on the client..

And ive tried to read the docs abt getStaticProps (idk if its related to this), but it didnt seem to work for me.

Also navigating feels a bit slow, fx if i go to /login for the first time. Is this caused bc im not using nextjs prperly? Or is it just during development?

To use “use client” in an Input component seems ok, but using it on a page has to be bad…




To see whole code for home page (i do this useEffect across my app, and if i know how to fix this on the simple page, i think i would be able to fix the others as well pls help)

https://github.com/mariangle/penpal-next-ts

app > (site) > page.tsx

Also am i even using the layout and page correctly? It got very tricky in (site) > letters and all the folders “inbox”, “sent” “pending”
Image

0 Replies