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

Binding in component classes

In the video you said: 7:21 "What it's saying is in all component classes will automatically bind all of our methods to the instance so we don't have to do this."

This is not true. The automatic binding only happens using the React.createClass.

If you use an ES6: class Name extends React.Component

you need to manually bind methods.

1 Answer

Should also note that when you do manually bind methods in ES2015/ES6 Component classes, you should do so for each method in the constructor, rather than inline in the render method, since then you only create a new bound function once, rather than on each render.