FAQ: this.props - Receive an Event Handler as a prop

This community-built FAQ covers the “Receive an Event Handler as a prop” exercise from the lesson “this.props”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn ReactJS: Part I

FAQs on the exercise Receive an Event Handler as a prop

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hi please someone can hep me i don’t understand very well , the difference between props and prop

1 Like

According to the Component and Props lesson step 5:
props is the name of the object that stores passed-in information. this.props refers to that storage object. At the same time, each piece of passed-in information is called a prop. This means that props could refer to two pieces of passed-in information, or it could refer to the object that stores those pieces of information

In Talker.js, why does Render not return <Button talk={this.props.talk} />

In the “Receive an Event Handler as a prop” section, how is this.props.talk able to be injected in the button doc if the Talker Component class was never exported on the talker doc nor imported on the button doc?

In case anyone wondering, it would be revealed in the next exercise. But basically, in Talker.js, this.talk refers to a method of Talker component named “talk”. Whereas this.props.talk refers to a prop (or attribute, as I would like to call it) of Button component named “talk”.

I think it’s because this.props.talk refers to the prop of the Button component. not the method of the Talker component.