I have some problem to print elements inside array.
This is my Code
const mapStateToProps = state => {
console.log('antipasti', state.antipasti)
return { antipasti: state.antipasti };
};
const ConnectedList = ({ antipasti }) => (
<ul>
{
antipasti
.filter(antipasto => !!antipasto )
.map(antipasto => {
console.log('antipasto', antipasto);
<li>{antipasto.title}</li>
})
}
</ul>
);
const List = connect(mapStateToProps)(ConnectedList);
export default List;
What I would to obtain:
I would to print the element inside state.antipasti, I have used the filter to not consider the undefined or null elements.
This console.log('antipasto', antipasto);
prints:
antipasto {title: "Prova"}title: "Prova"__proto__: Object
so I have thought to use antipasto.title to obtain the title, but nothing appears.
I have imported this page, in another parent page only with