function useIsInitialMount() {
  const isInitialMountRef = React.useRef(true)

  React.useEffect(() => {
    isInitialMountRef.current = false

    return () => {
      isInitialMountRef.current = true
    }
  }, [])

  return isInitialMountRef.current
}
Tracks if it's the first render.