React - Pass an Array as Props

Tell us what’s happening:

Describe your issue in detail here.
// running tests The

ToDo

component should return a single outer

div

. The third child of the

ToDo

component should be an instance of the

List

component. The fifth child of the

ToDo

component should be an instance of the

List

component. Both instances of the

List

component should have a property called

tasks

and

tasks

should be of type array. The first

List

component representing the tasks for today should have 2 or more items. The second

List

component representing the tasks for tomorrow should have 3 or more items. The

List

component should render the value from the

tasks

prop in the

p

tag. // tests completed // console output [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] Build error, open your browser console to learn more. [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)] [TypeError: Cannot read properties of undefined (reading ‘join’)]

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={["Walk", "Cook", "Bake"]} />
        
        <List/>
        <h2>Tomorrow</h2>
        <List/>
       <List tasks={["Study", "Code", "Eat"]} />
        { /* Change code above this line */ }
      </div>
    );
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

React - Pass an Array as Props

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Welcome to the forum @AswaniMohanan

Please remove the List components shown in the code block below.
They were not asked in the instructions, so will fail the tests.

Happy coding

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.