Real-Life Use-Cases for useCallback and useMemo


https://c.tenor.com/

useCallback

const getValue = useCallback((value) => console.log(value), []);

useMemo

const reducedValue = React.useMemo(() => array.reduce((a,b) =>{console.log('computed again') return a + b;}), [])
https://c.tenor.com/

Create ShowMoreTextToggler

Conclusion

Comments

Popular posts from this blog

React's useImperativeHandle with practical example | by ByteCode Pandit

Understand NgModule in 15 mins | by Bytecode Pandit