Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
const List = props => {
return <p>{props.tasks.join(',')}</p>;
};
class ToDo extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<h1>To Do Lists</h1>
<h2>Today</h2>
<List tasks={["Walk", "Cook", "Bake"]} />
<h2>Tomorrow</h2>
<List tasks={["Study", "Code", "Eat"]} />
</div>
);
}
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Challenge: Pass an Array as Props
Link to the challenge:
here i tried all possible solutions and tried different tests, pasted the solved code here, but anyhow one error is always there with the qoute
test timed out
const List = props => {
return
{props.tasks.join(‘,’)}
;
};
class ToDo extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
To Do Lists
Today
<List tasks={[“Walk”, “Cook”,“Eat”, “Sleep”]} />
Tomorrow
<List tasks={[“Study”, “Code”, “Eat”]} />
);
}
}
There’s no space between your list items when they’re displayed.
Walk,Cook,Bake
The instructions tell you to use join(", ")
, but it looks like your code is a little different.
I have tried pasting the same code given in that hint page and the error is same
1 Like
What’s your new code?
As I said above, you need to use join(", ")
so that the output has a space after the commas
// your output
Walk,Cook,Bake
// expected output
Walk, Cook, Bake
1 Like
yeah bro , thanks I guess that was the issue , thanks for the help.
system
Closed
8
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.