I would like add inline conditional in my React Component, but i don't understand why, React return Unexpected token, expected on the line posts.length ? :
class PostList extends Component {
getPosts() {
const posts = Post.find().fetch();
return posts;
}
render() {
const posts = this.getPosts();
return (
{posts.length ?
<ul>
{posts.map((post) => (
<PostItem key={post.title} post={post} />
))}
</ul>
}
);
}
}
Anyone have idea ? My conditional is wrong ?
Thank you community !
?part and the:part, and you cannot drop an expression into a{ }object initializer like that anyway.{ posts.length ????in JavaScript before, only in C#.