How to refactor an existing client component into a server component?
@asidorenko_35K followers
112,433 views
10 Comments
Comments from the original post on X (Twitter)

@manduks
You are killing it, lot of things I learned seeing your videos, will be nice to have a web page that renders all these tips so I don’t have to bookmark them 😅, anyways awesome content!
6 likes

@asidorenko_
Thanks, I am working on the dedicated page. *Also secretly hoping that @X will implement better UI for tweet collections so I don't have to build anything
5 likes

@fredkisss
Now what is missing is adding Suspense to show loading states on the server, or use useTransition (in the Search client component) to show loading state on the client.
5 likes

@NithurM
It would be cool if we can generate these pages statically
4 likes

@asidorenko_
We can. 1. Substitute query params with dynamic routes. So the route looks like this /movies/doctor instead of /movies?search=doctor 2. Pass most popular search requests to generateStaticParams
18 likes

@bWgibb
@asidorenko_ pardon the noob but sincere question, but what is the purpose of doing this? How is the code better in moving to the server?
4 likes

@asidorenko_
Good question, nothing noob about it. - Ship less JS to the client (improves time to interactive) - Can use secret keys when fetching data - Less client-side re-rendering - Can pre-generate popular search queries at build time - State in the URL is often better UX
19 likes

@Armo_MXT
Thanks for creating amazing content!
2 likes

@hemanta_io
Make some videos on Next js middlewares.
1 like

@asidorenko_
Do you have any specific cases in mind?