Client/Server Components

Last Edited On: August 26, 2024 @ 7:31 PM

When using the two it can be very difficult to get your head around the concept when building an application since it will force you to structure a web application.

One of the main reasons why I am writing a blog about this is the way to manipulate components from their naturistic features for example, and this blew my mind, was the way to use the the router to automatically call a server function.

I will explain in more detail, lets say that you have a server Action that calls a query to the database to get all of a user’s books they will use the server action to make this happen. What about when you want to add a new feature in to search the books that you have? You can use the manipulation of the Url as a search param and every time that Url param changes it will automatically call the server action again. So you do not have to force the update.

I was shocked on how this worked and I had to write it down since it is something that I have not even thought could work/behave like that.

I got to know how to make this work thanks to Lee Robinson which works at Vercel. Here is the tweet he made talking about how it works along with some examples.