我有一个包含数组中的对象的钩子。该对象本身包含带有键的子对象:
const [Value, setValue] = useState([
{
Item1: [
{
SubItem11: [{test_key1: "text", test_key2: "another text"}],
SubItem12: [{test_key1: "text", test_key2: "another text"}]
}
],
Item2: [
{
SubItem21: [{test_key1: "text", test_key2: "another text"}],
SubItem22: [{test_key1: "text", test_key2: "another text"}]
}
]
}
])
请告诉我如何使用map. 另外,您能否展示一个仅访问特定对象键的示例?例如,如何仅访问SubItem12?
谢谢你!
对于这样的任务,你的状态是极其不方便的……:(
但你可以从中做出一个选择。
例如,您可以这样做......