Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Basics (retired) Stateful Components Updating State

SH Ding
SH Ding
3,125 Points

At 6:30 in this video, what is the difference between calling decrementScore and decrementScore().

What is the difference between each of the two and what it does? When would you choose one over the other?

1 Answer

Steven Parker
Steven Parker
229,732 Points

When you use just the name of a method as an argument, you are passing a reference to the function itself. This is often referred to as a "callback". The function is not called by making this reference.

When you put parentheses after a method name, with or without arguments inside, you are calling the function, and what you pass as the argument is whatever the function returns when it finishes running.

Which one of these you would use is determined by the argument requirements of the function you are passing it to, and possibly also by what the function returns.