I can make nested dropdown without problems but I have no idea how to make it dynamic. It can go even up to 5-8 levels deep. I understand that it could be done with help of .map() function which will be called inside itself again if there is any more sub-dropdowns. So this way I could access all data but what to do next I don't know.
Array looks something like this(Just some part of it):
categories = [
{
title : "Electronics", path : "Electronics", id : 1, subCat: [
{title : "Computers", path : "Electronics->Computers", id : 11, subCat: [
{title : "Desktop", path : "Electronics->Computers->Desktop", id : 111, subCat: [
{title : "Gaming", path : "Electronics->Computers->Desktop->Gaming", id : 1111, subCat: null},
{title : "Office", path : "Electronics->Computers->Desktop->Office", id : 1112, subCat: null}
]},
{title : "Laptops", path : "Electronics->Computers->Laptops", id : 112, subCat: [
{title : "Gaming", path : "Electronics->Computers->Laptops->Gaming", id : 1121, subCat: null},
{title : "Office", path : "Electronics->Computers->Laptops->Office", id : 1122, subCat: null}
]}
]}
]
},
{
title : "Cars", path : "Cars", id : 2, subCat: [
{title : "Parts & Accessories", path : "Cars->Parts & Accessories", id : 21, subCat: [
{title : "Car Parts", path : "Cars->Parts & Accessories->Car Parts", id : 211, subCat: null},
{title : "Car Accessories", path : "Cars->Parts & Accessories->Car Accessories", id : 211, subCat: null},
{title : "Parts", path : "Cars->Parts & Accessories->Parts", id : 212, subCat: null},
{title : "Paintwork", path : "Cars->Parts & Accessories->Paintwork", id : 213, subCat: null},
{title : "Tyres & Rims", path : "Cars->Parts & Accessories->Tyres & Rims", id : 214, subCat: [
{title : "Tyres", path : "Cars->Parts & Accessories->Tyres & Rims->Tyres", id : 2141, subCat: null},
{title : "Rims", path : "Cars->Parts & Accessories->Tyres & Rims->Rims", id : 2142, subCat: null},
{title : "Trims", path : "Cars->Parts & Accessories->Tyres & Rims->Trims", id : 2143, subCat: null},
{title : "Accessories", path : "Cars->Parts & Accessories->Tyres & Rims->Accessories", id : 2144, subCat: [
{title : "Hub Centre Caps", path : "Cars->Parts & Accessories->Tyres & Rims->Accessories->Hub Centre Caps", id : 21441, subCat: null},
{title : "Valve Caps", path : "Cars->Parts & Accessories->Tyres & Rims->Accessories->Valve Caps", id : 21442, subCat: null},
{title : "Tyre Bags", path : "Cars->Parts & Accessories->Tyres & Rims->Accessories->Tyre Bags", id : 21443, subCat: null}
{title : "Bolts & Nut Covers", path : "Cars->Parts & Accessories->Tyres & Rims->Accessories->Bolts & Nut Covers", id : 21444, subCat: null}
]},
]}
]}
]
}
]
Could anybody help me out here please with some idea or example? Thanks.