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 Components (2018) React Component Patterns React Component Patterns Review

I would greatly appreciate your help

I cannot figure out what goes in the blank,I have watched the video several times. Can you please help

Question Complete the code to provide the Greeter component a default value for the greeting prop.

Greeter.____ = { greeting: 'To infinity…and beyond!' };

2 Answers

rydavim
rydavim
18,813 Points
Greeter.____ = {  //You can set default values using defaultProps
    greeting: 'To infinity…and beyond!' 
};

I'm not really familiar with React, so I can't really go into a thorough explanation, but I referred to this blog writeup to find the answer. Good luck, and happy coding!

defaultProps