Simply using memoize without useCallback (or useMemo as in the update) wouldn't work, as on next render it would invoke memoize from fresh like this:let memoized = memoize(fn) memoized('foo', 3, 'bar')memoized('foo', 3, 'bar') // cache hitmemoized = memoize(fn); // without useCallback (or useMemo) this would happen on next render // Now the previous cache is lost 这篇关于使用参数反应 useCallback的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-17 21:16