Refactoring (pages/) - client component fetching data on click
Unanswered
Griffon Nivernais posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
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](https://cdn.discordapp.com/embed/avatars/0.png)
Griffon NivernaisOP
Bump.
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Griffon NivernaisOP
Bump.
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Toyger
it look decent enough. why you want to improve it?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
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](https://cdn.discordapp.com/embed/avatars/0.png)
Griffon NivernaisOP
Decided to leave as is, thanks for the help! :)