2017-04-27 3 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 
관련 문제