init commit,
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import supabase from '../../utils/supabase'
|
||||
|
||||
export default function ClientPosts() {
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [posts, setPosts] = useState<any>([])
|
||||
|
||||
useEffect(() => {
|
||||
const fetchPosts = async () => {
|
||||
const { data } = await supabase.from('posts').select()
|
||||
setPosts(data)
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
fetchPosts()
|
||||
}, [])
|
||||
|
||||
return isLoading ? <p>Loading</p> : <pre>{JSON.stringify(posts, null, 2)}</pre>
|
||||
}
|
Reference in New Issue
Block a user