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 trialfredyrosales
10,572 Pointsthis,props.score
HI! I'm really enjoying this React course as it seems to be a challenge. I'm fairly understanding everything as we progress. I just would like if someone can re iterate in words why we put the this. Is the this connected to the class itself?
2 Answers
Jesus Mendoza
23,289 PointsHey,
If you notice; React.createClass takes an object as argument, so "this" will point to that object.
So, when you use your new class to create a new component and pass prop to that component class, "this" will points to that component(object) and this.props will point to that object propTypes.
Brice Roberts
22,415 PointsDead issue, I know...
But, If any future students are looking into this question, take a look at this course if you're having trouble with "this".
https://teamtreehouse.com/library/understanding-this-in-javascript
shubhamvinay
3,741 Pointsshubhamvinay
3,741 PointsI am sorry I am still having a hard time following. If this.props.score is not used, then what will props.score search for ?