-
Notifications
You must be signed in to change notification settings - Fork 0
afc afcMemo
Александр edited this page Jan 8, 2023
·
1 revision
export function afc<P>(constructor: AFC<P>, options?: AFCOptions): React.FC<P>
export function afcMemo<P>(constructor: AFC<P>, options?: AFCOptions): ReturnType<React.memo>
Accepts a constructor function, which should return the usual component function.
Returns the wrapped component. Not add an extra node to the virtual DOM.
import { afc } from 'react-afc'
function Component(props) {
// constructor logic
return () => (
<div>example text</div>
)
}
export default afc(Component)
If you have a problem with the visibility of previous props when they should no longer be,
then set the lazyPropsUpdate
flag in options
export default afc(Component, { lazyPropsUpdate: true })
Component
Lifecycle
State
Redux
Other