Vasim Shaikh’s Post

Your useEffect dependency array is lying to you. You added []  because "it runs once, right?" Then six months later, data is stale, linters are screaming, and you're passing setState into useCallback chains that look like spaghetti. Here's the rule: Empty array? Only if it truly runs once (on mount) Missing dependencies? Your bugs will find them Object/array dependencies? Memoize or restructure Pro tip: If your useEffect is doing too much, it's not a dependency problem. It's a separation problem. Break it up. Your future self will thank you. #reactjs #javascript #webdev #coding #frontend

There is only one rule for useEffect: Dont use useEffect There very few cases when you really use useEffect

Like
Reply

To view or add a comment, sign in

Explore content categories