0

I'm trying to console.log a variable's value but on the browser console instead of printing the variable (an object in my case), I am getting a Proxy container with format like Proxy {}[[Handler]]: En[[Target]]: Array(0)[[IsRevoked]]: false

On opening the [[Handler]], I get some inner properties which contains an originalTarget property. On expanding the originalTarget , my data is shown.

How do I get this data to show properly in console and also access it in my LWC ?

this.variableName returns value in a Proxy

2 Answers2

1

If you want to view proxy data so use this :

JSON.stringify(this.caseList)

And further if you want to use it in your lwc use this:

let cases = JSON.parse(JSON.stringify(this.caseList))
console.log(cases);

I hope you find the above solution helpful. If it does, please mark it as Best Answer to help others too.

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
-1

Reason : whenever we mark any Javascript object as @track, Salesforce wraps the object inside creating proxy objects.

Solution: @Rajat Jaiswal answer.

LoneWolf
  • 119
  • 1
  • 11
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 19 '22 at 05:54