0
我試圖調用getElementByKey()
功能,我映射的集合:ReactJS - 呼叫從地圖功能的功能,功能沒有定義
{this.state.sections.map(function(section) {
return (<Tab key={section.value} title={section.label}>
{this.getElementByKey(section.name)}
</Tab>);
})}
這裏是我想要調用方法:
getElementByKey: function(name){
switch(name) {
case "EditStudentBasicDetails":
return <EditStudentBasicDetails studentId={this.state.studentId} sectionData={this.state.studentData.activeData.basicDetails} />;
case "EditStudentAgentsInfo":
return <EditStudentAgentsInfo studentId={this.state.studentId} sectionData={this.state.studentData.activeData.agentsInfo} />;
case "EditStudentCaseNotes":
return <EditStudentCaseNotes studentId={this.state.studentId} sectionData={this.state.studentData.activeData.caseNotes}/>;
case "EditStudentRegistration":
return <EditStudentRegistration studentId={this.state.studentId} sectionData={this.state.studentData.activeData.registration} />;
case "EditStudentContactDetails":
return <EditStudentContactDetails studentId={this.state.studentId} sectionData={his.state.studentData.activeData.contactDetails} />;
case "EditStudentAttendance":
return <EditStudentAttendance studentId={this.state.studentId} sectionData={this.state.studentData.activeData.attendance} />;
case "EditStudentSENDetails":
return <EditStudentSENDetails studentId={this.state.studentId} sectionData={this.state.studentData.activeData.SENDetails} />;
case "EditStudentSENReviews":
return <EditStudentSENReviews studentId={this.state.studentId} sectionData={this.state.studentData.activeData.SENReviews} />;
default:{
}
}
},
我得到錯誤,this.getElementByKey不是一個函數,任何人都可以請幫忙嗎?