mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
* feat(blog): Add React Query post. * feat(examples): Add React Query example. * Apply suggestions from code review Thank you 💚 Co-authored-by: Philipp Steinrötter <philipp@steinroetter.com> * chore: update og image. --------- Co-authored-by: Philipp Steinrötter <philipp@steinroetter.com>
20 lines
599 B
TypeScript
20 lines
599 B
TypeScript
// app/posts/posts.jsx
|
|
'use client'
|
|
|
|
import useSupabaseBrowser from '@/utils/supabase-browser'
|
|
import { getCountryById } from '@/queries/get-country-by-id'
|
|
import { useQuery } from '@supabase-cache-helpers/postgrest-react-query'
|
|
|
|
export default function Country({ id }: { id: number }) {
|
|
const supabase = useSupabaseBrowser()
|
|
// This useQuery could just as well happen in some deeper
|
|
// child to <Posts>, data will be available immediately either way
|
|
const { data: country } = useQuery(getCountryById(supabase, id))
|
|
|
|
return (
|
|
<div>
|
|
<h1>SSR: {country?.name}</h1>
|
|
</div>
|
|
)
|
|
}
|