@reactivers/hooks Github link@reactivers/hooks NPM link

useMounted

Introduction

  • useMounted returns when a component mounted.
  • You can track lifecyle of any component.
  • Somehow if you need to know that a component is mounted or not, you can get it easily.
const mounted = useMounted();

Getting Started

  • You need to import useMounted.

From Collection

import { useMounted } from "@reactivers/hooks";

From Package

import { useMounted } from "@reactivers/use-mounted";

Interfaces

Returns

interface IUseMounted {
    mounted: boolean;
}

Example

Example Preview - CodeSandbox