Data fetch

This commit is contained in:
CHIEFSOFT\ameye
2025-01-01 19:45:14 -05:00
parent 79a402d31d
commit 083fe44c29
7 changed files with 170 additions and 96 deletions
+23 -1
View File
@@ -1,7 +1,29 @@
//"use server"
import VideoPopup from "../components/elements/VidepPopup"
import Layout from "../components/layout/Layout"
import Link from "next/link"
export default function Home() {
import {useState, useEffect } from "react";
export default function Home() {
const [posts, setPosts] = useState(null)
useEffect(() => {
async function fetchPosts() {
try {
const res = await fetch('https://blogdata.chiefsoft.net/blogdata/mermsemr')
const data = await res.json()
setPosts(data)
console.log(data)
}
catch(e){
console.log(e)
}
}
fetchPosts().then(r => {
console.log(r)
})
}, [])
return (
<>