我需要在函数中返回一个const。这是我的代码:
ValidarSections(){
if(global.titulo === "Telefonia - Implementaciones"){
return SECTIONS = [
{
title: "Milestone",
content: this.state.Milestone
}
]
}
if(global.titulo === "Telefonia - Integraciones"){
return SECTIONS = [
{
title: "Relevamiento",
content: this.state.RelevamientoINT
},
{
title: "Instalaciones",
content: this.state.Instalaciones
},
{
title: "Integraciones",
content: this.state.Integracion
}
]
}
if(global.titulo === "Obras Civiles"){
return SECTIONS = [
{
title: "Obra",
content: this.state.Obra
},
{
title: "Relevamiento",
content: this.state.RelevamientoOBR
}
]
}
}
render() {
const SECTIONS = this.ValidarSections()
....
}
以便能够在库Accordion中使用此const。 我是新来的,我会尽我所能来做这件事?
答案 0 :(得分:0)
您不返回常量,而是返回值。从您的退货声明中删除PluginFactories
:
SECTIONS =