let component = [];
switch(foo) {
case 'bar':
component = <TheBarComponent/>
break;
case 'baz':
component = <TheBazComponent/>
break;
case ...
}
// set component properties here.
鑑於在switch
所有組件都具有相同的道具簽名,我該如何設置他們在一個地方,而不是在襯裏他們都在每case
聲明?