Search...
A React Hook for determining whether the component is currently in its initial render.
Open the console to see the log. (Rspress will render twice when demo mounted)
const isFirstRender = useFirstRender() // when component first renders console.log(isFirstRender) // true // when component re-renders console.log(isFirstRender) // false
Click links below to view source on GitHub.
const isFirstRender = useFirstRender()
A boolean value indicating whether the component is currently in its first render phase.
boolean