Here is what the above code is Doing:
1. The addItem function is called immediately, and the result of that function call is passed to the ActionButton component.
2. The ActionButton component calls the function that was passed to it, which is the result of the addItem function call.
The solution is to wrap the addItem function call in an anonymous function. This way, the addItem function is not called immediately, but instead is called when the anonymous function is called.