UNPKG

@pidoc/components

Version:

Components for generating a dynamic documentation experience like for docs.piral.io.

20 lines (14 loc) 400 B
import * as Stickyfill from 'stickyfilljs'; import { useRef, useEffect } from 'react'; export function useStickySidebar() { const container = useRef(undefined); useEffect(() => { const element = container.current; if (element) { Stickyfill.add(element); return () => Stickyfill.remove(element); } return () => {}; }, [container.current]); return container; }