UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

15 lines (13 loc) 516 B
'use client'; import * as React from 'react'; const EMPTY = []; /** * A React.useEffect equivalent that runs once, when the component is mounted. * @ignore - internal hook. */ export function useOnMount(fn) { // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- no need to put `fn` in the dependency array /* eslint-disable react-hooks/exhaustive-deps */ React.useEffect(fn, EMPTY); /* eslint-enable react-hooks/exhaustive-deps */ }