console.log cannot get the data [ value below was evaluated just now ] [duplicate]












0
















This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • Is Chrome's JavaScript console lazy about evaluating arrays?

    6 answers




I can't reach the data.



MyApi.js



fetch('https://reqres.in/api/users?page=2')
.then(res => res.json())
.then((result) => {
UsersAPI.users.push(result.data)
});

const UsersAPI = {
users: ,
};

export default UsersAPI;


MyUsers.js



 export default class MyUsers extends Component {
render() {
console.log(UsersAPI.users);
return (
<div></div>
) ....


Console



console.log( UsersAPI.users[0] ) not working. How can I show data in the console. If my code is wrong you can make changes to my code










share|improve this question













marked as duplicate by deceze javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 31 '18 at 11:10


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • You can’t rely on the timing of the data becoming available without explicitly chaining on the promise’s .then.

    – deceze
    Dec 31 '18 at 11:12
















0
















This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • Is Chrome's JavaScript console lazy about evaluating arrays?

    6 answers




I can't reach the data.



MyApi.js



fetch('https://reqres.in/api/users?page=2')
.then(res => res.json())
.then((result) => {
UsersAPI.users.push(result.data)
});

const UsersAPI = {
users: ,
};

export default UsersAPI;


MyUsers.js



 export default class MyUsers extends Component {
render() {
console.log(UsersAPI.users);
return (
<div></div>
) ....


Console



console.log( UsersAPI.users[0] ) not working. How can I show data in the console. If my code is wrong you can make changes to my code










share|improve this question













marked as duplicate by deceze javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 31 '18 at 11:10


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • You can’t rely on the timing of the data becoming available without explicitly chaining on the promise’s .then.

    – deceze
    Dec 31 '18 at 11:12














0












0








0









This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • Is Chrome's JavaScript console lazy about evaluating arrays?

    6 answers




I can't reach the data.



MyApi.js



fetch('https://reqres.in/api/users?page=2')
.then(res => res.json())
.then((result) => {
UsersAPI.users.push(result.data)
});

const UsersAPI = {
users: ,
};

export default UsersAPI;


MyUsers.js



 export default class MyUsers extends Component {
render() {
console.log(UsersAPI.users);
return (
<div></div>
) ....


Console



console.log( UsersAPI.users[0] ) not working. How can I show data in the console. If my code is wrong you can make changes to my code










share|improve this question















This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • Is Chrome's JavaScript console lazy about evaluating arrays?

    6 answers




I can't reach the data.



MyApi.js



fetch('https://reqres.in/api/users?page=2')
.then(res => res.json())
.then((result) => {
UsersAPI.users.push(result.data)
});

const UsersAPI = {
users: ,
};

export default UsersAPI;


MyUsers.js



 export default class MyUsers extends Component {
render() {
console.log(UsersAPI.users);
return (
<div></div>
) ....


Console



console.log( UsersAPI.users[0] ) not working. How can I show data in the console. If my code is wrong you can make changes to my code





This question already has an answer here:




  • How do I return the response from an asynchronous call?

    33 answers



  • Is Chrome's JavaScript console lazy about evaluating arrays?

    6 answers








javascript reactjs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 31 '18 at 11:09









tom clarcktom clarck

84




84




marked as duplicate by deceze javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 31 '18 at 11:10


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by deceze javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 31 '18 at 11:10


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • You can’t rely on the timing of the data becoming available without explicitly chaining on the promise’s .then.

    – deceze
    Dec 31 '18 at 11:12



















  • You can’t rely on the timing of the data becoming available without explicitly chaining on the promise’s .then.

    – deceze
    Dec 31 '18 at 11:12

















You can’t rely on the timing of the data becoming available without explicitly chaining on the promise’s .then.

– deceze
Dec 31 '18 at 11:12





You can’t rely on the timing of the data becoming available without explicitly chaining on the promise’s .then.

– deceze
Dec 31 '18 at 11:12












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas