Reputation: 3139
I am fetching a topic's title from the store, but I get this message
react-dom.development.js:14348 Uncaught (in promise) Error: ReadBlogPage(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
This is part of my code
const BlogDahsboardPage = () => (
<div>
<TopicsListFilters />
<TopicsList />
<ReadBlogPage />
</div>
);
export default BlogDahsboardPage;
and
const ReadBlogPage = (props) => {
<div>
<h1>{props.topics.title}</h1>
</div>
}
const mapStateToProps = (state) => {
return {
topics: selectTopics(state.topics, state.filters)
};
};
export default connect(mapStateToProps)(ReadBlogPage);
How can I fix that error? Thanks, Theo.
Upvotes: 0
Views: 18
Reputation: 419
Your code is wrong:
const ReadBlogPage = (props) => { // true, Nothing was returned from render. :-)
<div>
<h1>{props.topics.title}</h1>
</div>
}
You should use return:
const ReadBlogPage = (props) => { // <----- problem, use return or (
return (
<div>
<h1>{props.topics.title}</h1>
</div>
)
}
Upvotes: 1