Server Components in the NextJS Framework
Let's consider the component created by us in the previous lesson:
export default function Test() {
return <h1>hello, user!</h1>;
}
As mentioned earlier, by default in NextJS all components are server-side. At the same time, we have access to all the features of the JSX language, except for working with states and other similar hooks.
For example, let's create a variable and output it in the layout:
export default function Test() {
let name = 'user';
return <h1>hello, {name}!</h1>;
}
Given an array of products:
let prods = [
'prod1',
'prod2',
'prod3',
];
Using a loop, output these products
as a ul list inside your
server component.