I have a project that I'm doing. I'm trying to do pagination using the NextJS 13 server component without using use client. We need to make the code work. Now this code only adds a parameter to the page url, but does not add entries to the screen. In theory, it should first show 1 article, then when the button is clicked, 1 more article, then another, and so on. Nothing is happening right now. //component fetch mdx files import fs from 'fs'; import path from 'path'; import matter from 'gray-matter'; interface Blog { meta: any; slug: string; } export function getAllPosts() { // 1) Set blogs directory const blogDir = "blog"; // 2) Find all files in the blog directory const files = fs.readdirSync(path.join(blogDir)); // 3) For each blog found const blogs: Blog[] = files.map((filename: string) => { // 4) Read the content of that blog const fileContent = fs.readFileSync(path.join(blogDir, filename), 'utf-8'
A site where you can share knowledge