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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Alex Hort-Francis](https://uploads.teamtreehouse.com/production/profile-photos/10826830/micro_IMG_20220313_122652_3-1.jpg)
Alex Hort-Francis
17,074 Points`props.id` vs `id` in the click event handler callback function.
At 1:00, I'm guessing that using props.id
wouldn't have worked; as in:
<button className="counter-action decrement" onClick={() => props.changeScore(props.id, -1)}>
1 Answer
![Bella Bradbury](https://uploads.teamtreehouse.com/production/profile-photos/11669503/micro_Bella_Bradbury_8x10a.jpg)
Bella Bradbury
Front End Web Development Techdegree Graduate 32,790 PointsAlex,
That would also be acceptable! It really comes down to the fact that because you're using props.id
multiple times, it makes sense to put it in a variable so that you're not repeating yourself. This would also make it much easier to change your code in the future if needed because you'd only have to change it in one place (the variable) as opposed to at every instance in your code.
Hope this helps!