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 trialNhan Tran
1,999 PointsWhat is the difference between function inside propTypes "onAdd" and function outside propTypes onSubmit?
What is the difference between function inside propTypes "onAdd" and function outside propTypes onSubmit?
Arturo Goicochea
8,077 Points+1 to this question.
Why was onAdd added inside propTypes, but onSubmit wasn't? What's the difference?
1 Answer
gevuong
2,377 PointsonAdd was added inside AddPlayerForm.propTypes because the onAdd is being passed as a prop from the Application component to AddPlayerForm component. onSubmit is not being passed as a prop from App component, and is defined within class AddPlayerForm. This is why onSubmit was not added inside propTypes. So the difference is that onAdd is being passed as a prop from another component, while onSubmit isn't and is used to submit the AddPlayer form. Does this answer your question?
Steven Parker
231,269 PointsSteven Parker
231,269 PointsCould you provide a link to the part of the course where this is introduced?