I am learning to react but I am stuck in one issue. I am trying to get the array properties in my Useritem.js file
this is my User.js file
import React, { Component } from 'react'
import Useritems from './Components/Useritems';
const User = () => {
state = {
users: [
{ name: 'David', age: '20', Position: 'developer' },
{ name: 'Francis', age: '20', Position: 'Software Engineer' },
]
}
return (
<div>
{this.state.users.map(user => (
<Useritems user={user} />
))}
</div>
);
}
export default User
And this is my Useritem.js file
import React from 'react'
const Useritems = ({ user: { name, age, job } }) => {
return (
<div>
<h1>{name}</h1>
<h2>{age}</h2>
<h3>{job}</h3>
</div>
)
}
export default Useritems
But I am getting an error saying that the property name is not defined