use-mounted

Returns true if the component is mounted

Import

Usage

useMounted hook returns true if component is mounted and false if it's not.

import { useMounted } from '@mantine/hooks';

function Demo() {
  const mounted = useMounted();
  return (
    <div>
      {mounted ? 'Component is mounted' : 'Component is not mounted'}
    </div>
  );
}

Definition

function useMounted(): boolean;