Link to sandbox: <https://codesandbox.io/s/cool-northcutt-7c9sr>

I have a catalog with furniture and I need to make dynamic breadcrumbs. There is an array with nested objects which 5 levels deep. When I'm rendering list of furniture, I 'm saving all indexes from which array this list. 

Expected output: Using my indexes, I need to parse object with nested array , get name of each object where belongs that index and save it in array 

Indexes that I saved when user clicked on inventories . Key is a object name and property is actual index.

```
menuIndexes : {
  buildings: 0,
  building_styles: 3,
  rooms: 2,
  room_fillings: 0,
  filling_types: 1,
}

```

That piece of data , where i'm rendering from list of furniture . Name property is a name of a link in menu

```
{
  buildings: [
    {
      name: 'office',
      building_styles: [
        {
          name: 'interior',
          rooms: [
            {
              name: 'open space',
              filling_types: [
                {
                  name: 'furniture',
                  room_fillings: [
                    {
                      name: 'items',
                       // rendering inventories
                      inventories: [

                        {
                          id: 1,
                          name: 'tv'
                        },
                        {
                          id: 2,
                          name: 'chair'
                        },
                        {
                          id: 3,
                          name: 'table'
                        },
                      ]
                    }
                  ]

                }
              ]
            }
          ]
        },
      ]
    },
  ]
}

```

This image to understand where I'm getting this saved indexes

[![enter image description here](https://i.stack.imgur.com/6MDMv.png)](https://i.stack.imgur.com/6MDMv.png)

I have tried to make recursive function but it only gets first array and doesn't go any further to nested arrays

```
  const displayBreadCrumbs = () => {
    let menuKeys = Object.keys(menuIndexes)
    console.log({ menuIndexes });
    console.log(file);
    let arr = []
    let i = 0
    let pathToParse = file

    if (i < menuKeys.length) {
      if (menuKeys[i] in pathToParse) {
        pathToParse = pathToParse[menuKeys[i]][menuIndexes[menuKeys[i]]]
        console.log('pathToParse', pathToParse);
        i = i + 1
        // displayBreadCrumbs()
      }
    }
  }

```