Answer the question
In order to leave comments, you need to log in
Cannot convert undefined or null to object. What could be the problem?
I can not understand why when I display the object it throws an error?
The object itself is definitely not empty. Through the console you can see that there is an object
class ShowList extends Component {
render() {
const showList = () => Object.values(this.props.articles).map(i => {
return (
<li key={i.id} className="app__list__showList">
</li>
)
})
return (
<ul className="app__list__showList">
{showList()}
{/* {console.log(this.props.articles)} */}
</ul>
);
}
}
const mapStateToProps = state => {
const data = state.fetchReducer;
return {
articles: data.data
}
}
export default connect(mapStateToProps)(ShowList);
Answer the question
In order to leave comments, you need to log in
Most likely an error in the reducer. Pass the null or undefined operator to spread.{ ...someValue }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question