-
Notifications
You must be signed in to change notification settings - Fork 0
useMemo
Александр edited this page Jan 17, 2023
·
1 revision
export function useMemo<T>(factory: () => T, depsGetter: () => any[]): () => T
Creates a memoized value getter
import { afc, useMemo, useReactive } from 'react-afc'
import OtherComponent from './OtherComponent'
function Component(props) {
const state = useReactive({
count: 0,
mult: 0
})
const getResult = useMemo(
() => ({ result: count * mult }),
() => [state.count, state.mult]
)
return () => (
<OtherComponent result={getResult()}/>
)
}
export default afc(Component)
Component
Lifecycle
State
Redux
Other