I would like to render this nested JS object inside React component into ol > li > ol > li format, and nested objects should be indented as per level.
(我想将此React组件内的嵌套JS对象呈现为ol> li> ol> li格式,并且嵌套对象应按级别缩进。)
JSON Sample data : https://jsfiddle.net/39o8nrpk/
(JSON示例数据: https : //jsfiddle.net/39o8nrpk/)
It will be great help if I can get the solution to render this data in a performant way using JavaScript.
(如果我可以获得使用JavaScript以高性能方式呈现此数据的解决方案,那将是非常有用的帮助。)
{
"data": {
"content": "Page Title",
"url": "/",
"categories": [
{
"href": "/",
"name": "level 1",
"category": [
]
},
{
"href": "/",
"name": "level 1",
"category": [
{
"href": "/",
"name": "level 2",
"category": [
]
},
{
"href": "/",
"name": "level 2",
"category": [{
"href": "/",
"name": "level 3"
},
{
"href": "/",
"name": "level 3"
},
{
"href": "/",
"name": "level 3"
}
]
},
{
"href": "/",
"name": "level 2",
"category": [
]
},
{
"href": "/",
"name": "level2",
"category": [{
"href": "/",
"name": "level3"
},
{
"href": "/",
"name": "level3"
},
{
"href": "/",
"name": "level3"
}
]
}
]
}
]
}
}
ask by Raghav translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…