Tell us what’s happening:
There is an error in the challenge, as the placing of the question mark isn’t explicit by the instructions. I just know it by experience:
const List = (props) => {
return <p>{props.tasks.join(', ')}</p>
< – THIS FAILS
return <p>{props.tasks?.join(', ')}</p>
< – THIS WORKS
};
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 = {["a","ba"]}/>
<h2>Tomorrow</h2>
<List/>
{ /* Change code above this line */ }
</div>
);
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0
Challenge Information:
React - Pass an Array as Props