I'm making my first React-Redux project.
I'd like to change the structure below simply.
const PresentationalComponent = ({
params,
query
}) => {
if (query.title === undefined) {
return (
<div>
<article>
<h2>{params.title}</h2>
<hr></hr>
<p>{params.content}</p>
</article>
</div>
);
} else {
return (
<div>
<div>
<article>
<h2>{query.title}</h2>
<hr></hr>
<p>{query.content}</p>
</article>
</div>
</div>
);
}
};
export default HomeDetail;
This is what I've tried. But it occurs error.
<article>
<h2>{query.title === undefined ? {item.title} : {query.title}}</h2>
Can we make it simple?