JavaScript React Basics First Steps in React JSX Review

Brian Lockerbie
Brian Lockerbie
Full Stack JavaScript Techdegree Graduate 17,194 Points

What is the value of the petName variable that is suppose to fill in the blank?

Im confused on this question I tried almost everything to answer this

2 Answers

Liam Clarke
MOD
Liam Clarke
Treehouse Moderator 19,724 Points

Hi Brian

To use a variable in JSX, you must wrap it in curly braces like so:

const petName =  'Ernie';
const header = (
  <header>
    <p>I have a pet named {petName}.</p> 
  </header>
);

You might find it useful to have a quick read of Introduction to JSX on the react website.

Hope this helps!

Brian Lockerbie
Brian Lockerbie
Full Stack JavaScript Techdegree Graduate 17,194 Points

Thank you for the quick response .. I kept trying 'Ernie' , {Ernie} , 'petName", everyone except that one. Thanks again for your help :)