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 Basics (2018) Introducing Props Setting and Using Props

Luke Markham
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Luke Markham
Front End Web Development Techdegree Graduate 17,289 Points

propTypes

I have a issue my eslint is throwing up over "title" & "totalPlayers" props

Says "title/totalPlayers missing in props validation"

What could I do to validate them ?

const Header = props => {
  const { title, totalPlayers } = props;
  return (
    <header>
      <h1>{title}</h1>
      <span className="stats">{totalPlayers}</span>
    </header>
  );
};

1 Answer

travis halarewich
travis halarewich
9,165 Points

Not 100% if this will fix your issue but you don't have parenthesis for your arrow function. I would try this const Header = (props) => { return ( <header> <h1>{props.title}</h1> <span className="stats">{props.totalPlayers}</span> </header> ); }