・The async components are rendered on the server side to retrieve data by using async/await. This enables you to access data from the database, generate HTML with the retrieved data, and send it to the client side. This improves the rendering performance effectively.
async function AsyncPage({ id }) {
//fetch data directly in the component
const result = await db.sample.get(id);
return (
<div>
<h1>{result.title}</h1>
<p>{result.content}</p>
</div>
);
}
Top comments (0)