I am trying to destructure the data object using Next.js in client side
When I console.log(data) I get the below object
requestId: '1660672989767.IZxP9g', confidence: {…}, meta: {…}, visitorFound: true, visitorId: 'X9uY7PQTANO2a77GOGX6'}
confidence: {score: 0.9235436984457595}
meta: {version: 'v1.1.786+e63208b3'}
requestId: "1660672989767.IZxP9g"
visitorFound: true
visitorId: "X9uY7PQTANO2a77GOG
Then I try to extract visitorId like below
const {visitorId} = data;
console.log(visitorId)
When I console visitorID I get the below error
TypeError: Cannot destructure property 'visitorId' of 'data' as it is undefined.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/FycXvnh
Comments
Post a Comment