Next.js Discord

Discord Forum

Refactoring (pages/) - client component fetching data on click

Unanswered
Griffon Nivernais posted this in #help-forum
Open in Discord
Avatar
Griffon NivernaisOP
At the moment I have [the following code](https://gist.github.com/cyrus01337/48b04d59b8327b6c4366e16e668a6ad4), don't mind what the imports or other components are for now, just assume everything is as it looks based on name alone. Is there any way that I can improve data-fetching given that this originated from the pages directory and am migrating over to the app directory?

6 Replies

Avatar
Griffon NivernaisOP
Bump.
Avatar
Griffon NivernaisOP
Bump.
Avatar
Toyger
it look decent enough. why you want to improve it?
Avatar
Griffon NivernaisOP
For future reference - incase there's a more ergonomic/concise way of doing this using say server components.
If there's no better and this is fine, I'll leave it as is though.
Avatar
Griffon NivernaisOP
Decided to leave as is, thanks for the help! :)