A small application that manages and displays users should have the possibility to change the data using "CRUD". However, I have to export the variable u.userID.
Given the class "UserManagementPage"
class UserManagementPage extends Component {
constructor(props) {
super(props);
this.state = {userList: []}
}
getUsersData() {
const hash="whatever"
const requestOptions = {
method: 'GET',
headers: { 'Authorization': `Basic ${hash}` },
};
axios
.get('https://localhost:443/user/', requestOptions)
.then(res => {
const data = res.data
console.log(data)
const users = data.map(u =>
<div>
<p>{u.userID}
</p>
</div>
)
this.setState({
users
})
})
.catch((error) => {
console.log(error)
})
}
componentDidMount(){
this.getUsersData()
}
export default UserManagementPage
How do I export u.userID so that I can reuse it in other classes?