I always did HTML and CSS. I am starting to study React and I honestly do not understand the reason for the error. It is very basic and I wanted to know if someone can explain it to me. Thank you very much !!
import React from 'react';
import ReactDOM from 'react-dom';
class ItemLista extends React.Component {
render () {
return (
<li>
<span>Nombre: {this.props.name}</span>
<span>Mail: {this.props.mail}</span>
</li>
);
}
}
class CuerpoLista extends React.Component {
render () {
return (
<ul>
{this.props.users.map(u => {
return (
<ItemLista
key={u.id}
name={u.name}
mail={u.mail}
/>
);
})}
</ul>
)
}
}
class App extends React.Component {
constructor() {
super();
this.state = {
users: [
{id: 1, name: "Sebastián", mail: "[email protected]"},
{id: 2, name: "Noelia", mail: "[email protected]"}
]
};
}
render () {
return (
<CuerpoLista users="this.state.users" />
);
}
}
ReactDOM.render(
<App />,
document.getElementById('root')
)