useUnmounted

A React Hook that return a Ref Getter that returns true if the component is unmounted.

Demo

Try to click Start Timer, and then click the "Toggle mount" button in one second to see the result.

Source

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

const isUnmounted = useUnmounted()

isUnmounted is a Ref Getter that returns a boolean value.

See Ref Getter for more details.

Returns

A Ref Getter that returns true if the component is unmounted.