React Server Components
Në shqip: Komponentët e serverit
ShpjegimiSQ
Server Components ekzekutohen vetëm në server: mund të lexojnë direkt nga databaza dhe s'i dërgojnë JavaScript shfletuesit. Komponentët interaktivë shënohen me "use client". Next.js i përdor si parazgjedhje.
EnglishEN
Server Components run only on the server: they can read straight from the database and send no JavaScript to the browser. Interactive components are marked with "use client". Next.js uses them by default.
Si ta mendosh
Si kuzhina që të sjell gjellën gati — s'të dërgon përbërësit dhe recetën.
Lexoje në anglisht
Like a kitchen that brings you the finished dish — not the ingredients and recipe.
Shembull kodijavascript
// Server Component — pa useState, pa JS në shfletues
export default async function Faqja() {
const termat = await db.terma.findMany();
return <ul>{termat.map((t) => <li key={t.id}>{t.emri}</li>)}</ul>;
}