Supercharge your React App Performance by 10X with these handy tricks.
10 ultimate hacks every Web Developer should know about.
THREAD π§΅ :
1. useState Lazy Initialization With Function
There are times when we need to set the initial value of the state from some variable or from a function that returns a value.
Since our function is in the body, every time a re-render happens, this function is getting called even if its value is not required (we only need it during the initial render).
+ Use the above-mentioned hack to boost performance