Skip to content

Commit

Permalink
push routes
Browse files Browse the repository at this point in the history
  • Loading branch information
kchenturtles committed Dec 23, 2023
1 parent c047e9f commit 1491d3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/postPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"use client";
import styles from "./postPreview.module.css";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/navigation";
import React from "react";


type Items = {
[key: string]: string;
Expand All @@ -10,6 +13,10 @@ type Items = {
export default function PostPreview({ post }: { post: Items }) {
const router = useRouter();

React.useEffect(() => {
router.push(`/blog/${post.slug}`);
});

return (
<div className = {styles.preview}>
<Link className = {styles.title} href={ `/blog/${post.slug}` }> {post.title}
Expand All @@ -18,4 +25,3 @@ export default function PostPreview({ post }: { post: Items }) {
</div>
);
}

0 comments on commit 1491d3c

Please sign in to comment.