The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
import { useCallback, useRef } from 'react'
export function useChatScroll() {
const containerRef = useRef<HTMLDivElement>(null)
const scrollToBottom = useCallback(() => {
if (!containerRef.current) return
const container = containerRef.current
container.scrollTo({
top: container.scrollHeight,
behavior: 'smooth',
})
}, [])
return { containerRef, scrollToBottom }
}