trying to get nextjs to work

This commit is contained in:
2022-11-06 22:52:29 +01:00
parent 78b57dc4ad
commit 3ac968a63c
10 changed files with 103 additions and 40 deletions

View File

@@ -1,14 +1,9 @@
import { getPosts } from '@/lib/getPosts';
import Posts from './posts';
export const revalidate = 10;
export default async function Page() {
const posts = await getPosts();
return (
<div className="space-y-6 pt-6">
<Posts posts={posts} />
<Posts />
</div>
);
}

View File

@@ -1,5 +0,0 @@
const PostCard = () => {
return <div></div>;
};
export default PostCard;

View File

@@ -1,14 +1,14 @@
'use client-only';
import { Post } from '@/lib/getPosts';
import { FC } from 'react';
import { getPosts } from '@/lib/getPosts';
import { cookies } from 'next/headers';
import { use } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
interface PostProps {
posts: Post[];
}
const Posts: FC<PostProps> = ({ posts }) => {
const Posts = () => {
const c = cookies();
const posts = use(getPosts());
return (
<>
{posts.map((p) => (