# Js this and callbacks - React 18: Intermediate Topics

**URL:** <https://forum.codewithmosh.com/t/js-this-and-callbacks-react-18-intermediate-topics/24949>\
**Category:** React\
**Created:** [February 6, 2024, 9:39pm UTC](https://forum.codewithmosh.com/t/js-this-and-callbacks-react-18-intermediate-topics/24949 "2024-02-06T21:39:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Evan413](https://avatars.discourse-cdn.com/v4/letter/e/bcef8e/32.png) [@Evan413](https://forum.codewithmosh.com/u/Evan413)\
**Post date:** [February 6, 2024, 10:13pm UTC](https://forum.codewithmosh.com/t/js-this-and-callbacks-react-18-intermediate-topics/24949/2 "2024-02-06T22:13:48Z")

</div>

found an explanation here, so class methods as callbacks are not bound by default

> [@''this'' in stand alone function](https://forum.codewithmosh.com/t/this-in-stand-alone-function/7695/2):
>
> When the render function is called, it has the correct this. So when it calls this.getBadgeColor() and this.formatCount(), those functions also have the correct this and everything works as expected. But notice that the render function isn’t calling this.handleIncrement, if it were you would see parentheses like this.handleIncrement(). Rather, it’s passing the handleIncrement function over to the onClick event to be called later. When you pass functions around, the this doesn’t automatically go …

---

_[View the full topic](https://forum.codewithmosh.com/t/js-this-and-callbacks-react-18-intermediate-topics/24949)._
