I’ve been having trouble understanding when to write functions as arguments with brackets and when not to do so and was hoping somebody could clarify it for me.
I feel like I have seen this in other frameworks or libraries but I am working through Redux and it’s what I’ll use as an example.
Sometimes when passing an already defined function to a Redux method, it can be passed just as a constant and others it needs to be followed by brackets. For example:
const store = Redux.createStore(reducerFunction);
That function does not require you to use brackets but:
store.dispatch( actionFunc() );
Does require you to follow it with brackets.
At first, I thought it had to do with ES6 arrow functions but I just passed the challenge below and It would not pass unless I added the brackets to an arrow function without parameters.
So my question is: is there any convention, general or specific for each framework, on how to write functions as arguments?