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