Currently learning react, when i try and run the following code:
var userData = {
name: 'Evans D',
occupation: ' Logistics Planner',
location: 'Birmingham, UK',
img: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTAlfOT5088Z6Bj8_qSsvp3UTlU3ub9H5wG1k6qJareFXS7uqDvsQ'
};
class userInfo extends React.Component {
render() {
return (
<div>
<h1>Name: {this.props.user.name} </h1>
<h2>Occupation: {this.props.user.occupation} </h2>
<h3>Location: {this.props.user.location} </h3>
// <img src={this.props.user.img} />
</div>
)
}
}
ReactDOM.render(
<userInfo user={userData}/>,
document.getElementById('userInfo')
);
<!DOCTYPE html>
<html>
<head>
<title>Github Battle</title>
</head>
<body>
<div id='userInfo'></div>
</body>
</html>
Console throws the following error :
'Unknown prop user
on tag. Remove this prop from the element.'
Any ideas on what I'm doing wrong?