-
Notifications
You must be signed in to change notification settings - Fork 0
useOnRender
Александр edited this page Jan 17, 2023
·
1 revision
export function useOnRender(callback: () => void): void
Accepts a function without arguments.
Calls it immediately and before each render.
import { useEffect as reactUseEffect } from 'react'
import { afc, useOnRender } from 'react-afc'
import { anyCommonHook } from './hooks'
function Component(props) {
useOnRender(() => {
reactUseEffect(/*...*/)
anyCommonHook()
})
return () => {/*...*/}
}
export default afc(Component)
Component
Lifecycle
State
Redux
Other