Error in Pass an Array as Props

What’s wrong with this?
I am getting the error " The List component should render the value from the tasks prop in the p tag."
But my code is already doing the same ?

Your code so far


const List= (props) => {
  { /* change code below this line */ }
  return <p>{props.tasks.join(',')}</p>
  { /* change code above this line */ }
};

class ToDo extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <h1>To Do Lists</h1>
        <h2>Today</h2>
        { /* change code below this line */ }
        <List tasks={["dsa","dsa","dsa"]}/>
        <h2>Tomorrow</h2>
        <List tasks={["dsa","dsa","dsa"]}/>
        { /* change code above this line */ }
      </div>
    );
  }
};

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/pass-an-array-as-props

You are missing a space after the comma in the join

1 Like