state = {
loading: true,
selectOrg: null,
users: []
}
componentDidMount() {
const users1 = []
getUsers()
.then(users => (this.users1 = users))
.then(() => this.setState({
loading: false,
users: users1,
orgs: orgs
}))
.then(() => {
console.log(this.users1) // [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}] тут все норм
console.log(this.state.loading) // false тут норм
console.log(this.state.users) // [] а в state пусто ...
});
}