devdropper87 devdropper87 - 1 year ago 90
AngularJS Question

debugging with pre tags - angularjs/reactjs

I use pre tags extensively to debug my code in angular js, like so:

<pre>{{vm.names | json}}</pre>

Two questions:

  1. how does this work under the hood?

  2. is there an equivalent tool
    with reactjs that lets you see variables' values in the view, instead
    of the more common console.logs/debuggers?

Answer Source

You can add <pre>{JSON.stringify(, null, 4)}</pre> to the Component holding state to "visualize" the data in your view.