Is there some functional programming rule that says that these two things are the same?
That is, I'm passing a function as a attribute in a React program and I was using the second version with the first parameter passed in. Just out of curiosity, I replaced with just passing the function and my app still worked but I'm confused why.
(to be extra clear, onFavoriteToggle is a function)
<SpeakerFavorite
favorite={favorite}
onFavoriteToggle={onFavoriteToggle}
/>
compared to
<SpeakerFavorite
favorite={favorite}
onFavoriteToggle={(fun) => {onFavoriteToggle(fun)}}
/>