Build a Football Player Card Builder - Step 34

Tell us what’s happening:

Struggling with how to add generics to the function. I’ve tried every which way I can think of but I don’t know where or how to add PlayerData as the generic type.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: index.tsx */
{/* User Editable Region */}
  const [player, setPlayer] = useState(defaultPlayer);  
  return <PlayerCard player={player} />;
{/* User Editable Region */}

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36

Challenge Information:

Build a Football Player Card Builder - Step 34

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-build-a-football-player-card-builder/69e8b296388ebbd517692bca.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @neat-hannah,

Don’t you need to use brackets rather than parentheses to specify a generic type?

specify that the state uses the PlayerData type as a generic

And isn’t the type supposed to be PlayerData ?

Happy coding

I’m sorry, I don’t understand what you mean. The code I posted doesn’t have a type in it, and I’m using parentheses to create the state variable, not to set a generic type. Could you please be clearer about what you mean?

Figured it out myself.