Im having a little trouble passing data to a map function and im not sure where im going wrong.
Im getting all the users when the component mounts, but after i get the users im trying to add a const. This all works, but then in the constructor when im trying to map the array it doesnt seem to pick it up.
class UserManagement extends Component {
fetchUsers() {
axios.get('http://apiyall.com/users')
.then(res => {
const dataTable = res.data;
})
.catch(err => console.log(err));
}
componentDidMount() {
this.fetchUsers();
}
constructor(props) {
super(props);
this.state = {
data: dataTable.map((prop, key) => {