2017-04-27 33 views
1
<SettingsDropdown labelName="Settings" items={[ 
    {name:'Feature Listing', handler:{this.handle_dropdown_featureListing}, divider:true} 
]}/> 

我的上述語法有什麼問題?jsx意外的令牌傳遞對象數組

我有

handle_dropdown_featureListing =() => { //something },但我得到了意外的標記錯誤依然。

回答

1
handler:{this.handle_dropdown_featureListing} 

這裏你有一個沒有鍵的對象字面值。

它必須是你需要

handler:{keyName: this.handle_dropdown_featureListing} 

或任何名稱。

或者,如果你需要傳遞一個函數引用 - 只是刪除花括號:

handler: this.handle_dropdown_featureListing