我想将这些状态对象加载到二维数组中。我需要它们以下列方式:
[
[
"josie",
"ally",
"fred"
],
[
"edward",
"ally",
"fred",
"goolly"
]
]
我需要这种方式,因为我需要一种方法来引用相对于子列表名称的子列表。
class App extends Component {
state = {
List: [
{
name: "josie",
sub: [
"ally",
"fred"
]
},
{
name: "edward",
sub: [
"ally",
"fred",
"goolly"
]
}
]
}
render() {
return (
<div>
</div>
);
}
}
export default App;
如果这太基本了,我深表歉意,但我真的在这方面打我的头。