如何检查om对象?

sth*_*mps 7 clojurescript om

我一直在关注om教程.我使用Light Table来设置外部浏览器连接.另外,在我的clojurescript代码中,我正在调用(enable-console-print!)将println语句发送到浏览器控制台.

问题是,当我打印om组件时...类似于:

(println (om/build my-component-function my-data))

我得到的输出是:

#<[object Object]>

如果我只是(om/build my-component-function my-data)在LightTable中进行评估,我也有同样的问题.

能够检查此对象将有助于调试.如何打印更有意义的内容?

小智 10

1尝试使用(.log js/console object)ClojureScript相当于console.log(object);

2您还可以为Google Chrome安装React Developer Tools扩展程序,这样您就可以浏览页面上的React/Om组件

  • 我还想补充一点(dom/render-to-str)对于调试非常有帮助(https://github.com/swannodette/om/wiki/Documentation#render-to-str) (2认同)