JSFiddle - React, Tailwind, and code Playground

JavaScript

window.addEventListener("load",function(){
    var bookmarks = [];
    chrome.bookmarks.getTree(function(tree){  
        createBookmarks(bookmarks,tree);
    });    
    chrome.tabs.query({},function(tabs){
        createTabs(tabs,bookmarks);
    });
});

function createTabs(tabs,arr){
var urls = arr.map(function(bookmark){
    return bookmark.url;
});
    var tabObjects = [];
    
    
    tabs.forEach(function(tab){
       var bookmarkInfo = {};
        var index = 0;
        while(index <= arr.length - 1 && arr[index].url !== tab.url)
        {
            index++;
        }
        if(index === arr.length) {
        bookmarkInfo = {isBookmarked:0,path:'not bookmarked'};
        }
        else {
            var path = new Array();         
            fetchPath(arr[index].parentId,path);
            console.log(path);
            console.log(path.length);
            bookmarkInfo = {isBookmarked:1,id:arr[index].id,parentId:arr[index].parentId};            
        }
        var tabObj = new Tab(tab.title,tab.url,tab.favIconUrl,tab.id,tab.windowId,bookmarkInfo);
        tabObjects.push(tabObj);        
    });    
    createVM(tabObjects);
}

function createBookmarks(arr,node) {
    if(!(node instanceof Array) && !node.children){
       // var url = (node.url.slice(-1) !== '/') ? node.url : node.url.slice(0,-1);  
        arr.push({url:node.url,id:node.id,parentId:node.parentId});
    }
    else if( node instanceof Array ) {
        node.forEach(function(n){
            createBookmarks(arr,n);
        });
        
    }
    else {
        createBookmarks(arr,node.children);
    }
  
}

function fetchPath(id,path){    
chrome.bookmarks.getSubTree(id,function(subtree){
    path.push(subtree[0].title);
    if(subtree[0].hasOwnProperty('parentId')) {
       fetchPath(subtree[0].parentId,path);
    }  
});  
    
}