
Posted on • Edited on
5 key takeaways from React Hooks
If you follow the great tech youtuberDave Gray He has a series where he breaks down react hooks.
In this article, I will mention five key takeaways that will help you understand react hooks better.
1Referential Equality:
This means when react goes to reference that function in memory, it is the same one and not a new one.
2useCallback:
This preserves a function, so that everytime the component re-renders, the function will not get re-created by react. i.e. We are giving the functionreferential equality
3useMemo:
This preserves the result of a function that is called, so that it does not have to be re-calculated everytime the component re-renders.
4useRef:
Its' value stays the same even after a change in state causes the component to re-render.
5useLayoutEffect:
It is kind of the same as useEffect, but its' side effect must finish running before it will paint to the DOM.
Note:side effect is the code inside useLayoutEffect
Thank you, please follow me
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse