Does cloning React elements that are server components cancel the performance benefit?

174 Views Asked by At

I have been trying out React Server Components in NextJS 13. I have stumbled on a case when I need to use the pattern of passing server components as props in a client component. The thing is, this is a HOC wrapper that attaches an onClick handler to each of its children.

Now, the way to do it in React is to call cloneElement with the new prop. I am no expert of React internals, especially when it comes to server components, so I wonder whether it would cause the server component to be rerendered on the client and thus cancel the performance benefits of using them?

0

There are 0 best solutions below