Passing a function instead of calling it in event handlers (onClick={handleClick()} instead of onClick={handleClick})
Passing vs. Calling Functions in Event Handlers A common React mistake is accidentally calling a function immediately instead of passing it as an event handler callback. This can cause unexpected….