Hi!
I am stuck at the Pass an Array as Props part of the React Curriculum.
Honestly i don’t know what’s wrong with my Code.
Do you have any idea, why it isn’t working?
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","dog","workout"] } />
<h2>Tomorrow</h2>
<List tasks= { ["hiking","watching the world cup","programming"] } />
{ /* change code above this line */ }
</div>
);
}
};
1 Like
Your code is working. What are you talking about?
Yeah, i thought so.
But it is not passing the Tests.
Thats why i am asking
Ok, case closed.
Changing the Browser made it possible to pass the Tests.
That’s weird, it should almost always work on any modern browsers. Anyway, congrats.
const List= (props) => {
{ /* change code below this line / }
return {props.tasks.join(’,’)}
{ / change code above this line */ }
};
class ToDo extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
To Do Lists
Today
{ /* change code below this line / }
<List tasks={[“one”,“two”]} />
Tomorrow
<List tasks={[“one”,“two”,“three”]}/>
{ / change code above this line */ }
);
}
};
i don’t know what wrong with me i cant pass this stage(i’m using safari).
But ridiculously i could pass with writer’s code.
i’m figuring it out now.
1 Like
the reason was white-space after ', ’ ( which is hella ridiculous)
return
{props.tasks.join(’, ‘)}
<<=== passed with this code
return
{props.tasks.join(’, ')}
<<=== failed with this code.
what’s the point?
1 Like
Thanks so much for mentioning that white space- I was going crazy wondering why mine wasn’t working. I suppose it is because they need to separated by a comma AND space?
1 Like
i don’t know .
maybe the developer forgot to mention it,
well f**k it! lol
gchan
August 14, 2018, 2:36am
10
I notice when I reset all the code and just re-write all the code with modifications, sometimes it will then accept.