console.log cannot get the data [ value below was evaluated just now ] [duplicate]
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.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
javascript reactjs
marked as duplicate by deceze♦
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.
add a comment |
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.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
javascript reactjs
marked as duplicate by deceze♦
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
add a comment |
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.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
javascript reactjs
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.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
javascript reactjs
asked Dec 31 '18 at 11:09
tom clarcktom clarck
84
84
marked as duplicate by deceze♦
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♦
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
add a comment |
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
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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