useSubscription

Subscribe to database changes in realtime.

import { useSubscription } from 'react-supabase'
function Page() {
useSubscription((payload) => {
console.log('Change received!', payload)
})
return ...
}

Passing options

During hook initialization:

useSubscription(
(payload) => {
console.log('Change received!', payload)
},
{
event: 'INSERT',
table: 'todos',
},
)