MCPcopy Index your code
hub / github.com/streamich/react-use / useFirstMountState

Function useFirstMountState

src/useFirstMountState.ts:3–13  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { useRef } from 'react';
2
3export function useFirstMountState(): boolean {
4 const isFirst = useRef(true);
5
6 if (isFirst.current) {
7 isFirst.current = false;
8
9 return true;
10 }
11
12 return isFirst.current;
13}

Callers 5

usePreviousDistinctFunction · 0.90
useUpdateEffectFunction · 0.90
useStateWithHistoryFunction · 0.90
DemoFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…