![](/img/trans.png)
[英]console.log(this) following by console.log(this.props) don't show same common values
[英]If I do not use React Developer Tools or put console.log() in code, is there any way to show values of “this.props” on “Console” tab of the browser?
作為標題,我想找到在React中打印組件的“ this.props”值的方法。
通常,我們可以將console.log()放入代碼中或使用React Developer Tools,方法是在打開“瀏覽器上的F12”后單擊“反應”選項卡,並在“控制台”選項卡上使用“ $ r”打印“道具” 。 但是,如果沒有代碼中的React Developer Tools或console.log(),我如何打印“ this.props”? 是否有任何包含React屬性的全局默認變量? 我試圖使用$('classID')....來找出道具,但它也僅在我單擊React Developer Tools后才出現React值。
加
console.log(this.props)
在您返回JSX之前
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.