3 ms·
It's not a function, it's an immediately-invoked function expression. Edit: I guess it would be a bit inefficient to invoke the IIFE every render just to initi
by kareemsabri 4y ago
It's not a function, it's an immediately-invoked function expression.
Edit: I guess it would be a bit inefficient to invoke the IIFE every render just to initialize the value once. Probably better to use useMemo with [] as the dependency list then, either one achieves the same result.
- tshaddox 4y agoI missed that you were immediately invoking the function expression. But yes, that doesn't save you from running the expensive calculation every subsequent render.