Files
supabase/packages/common/hooks/useEffectEvent.ts
T
Francesco Sansalvadore d24df14aab Feat/toc component (#33964)
* test fuma toc

* make toc work

* ok toc

* ui-patterns toc

* fix types

* cleanup

* fix overflow issues

* cleanup

* fix loading w

* Update apps/docs/components/GuidesTableOfContents.tsx

* fix prettier

* format

* install deps

* target ES2018

* tweak regex

* update docs test snapshots

* fix useSubscribeTocRerender
2025-03-05 23:10:02 +01:00

15 lines
349 B
TypeScript

'use client'
import { useCallback, useRef } from 'react'
/**
* Don't use this, could be deleted anytime.
*
* @internal
*/
export function useEffectEvent<F extends (...params: never[]) => unknown>(callback: F): F {
const ref = useRef(callback)
ref.current = callback
return useCallback(((...params) => ref.current(...params)) as F, [])
}