Next.js Discord

Discord Forum

Deduplication vs pass by prop in a list?

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
In a list where you have multiple card components you typically do the fetching outside the card components to be able to render the list. Since you have already fetched all items you typically just pass the individual list item as property to the component on each map iteration.

My card component however can both be used by itself or as a part of a list, so I'm tempted to just pass the id and let each card make its own deduplicated request, so this server component card is truly reuseable.

Something inside me screams that deduplication is not free and that this could be a performance killer, but does anyone know if we're encouraged to utilize deduplication to the extreme like in this scanario or if props "drilling" is still the recommended approach in list/item cases?

0 Replies