JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>

JavaScript

var catalog = [
    {
        category:"a1",
        children:[
            {
                category:"a2",
                children:[]
            },
            {
                category:"b2",
                children:[
                    {
                        category:"a3",
                        children:[]
                    },
                    {
                        category:"b3",
                        children:[]
                    }
                ]
            },
            {
                category:"c2",
                children:[]
            }
        ]
    },
    {
        category:"b1",
        children:[]
    },
    {
        category:"c1",
        children:[
            {
                category:"d2",
                children:[
                    {
                        category:"c3",
                        children:[]
                    },
                    {
                        category:"d3",
                        children:[
                            {
                                category:"a4",
                                children:[]
                            },
                            {
                                category:"b4",
                                children:[]
                            },
                            {
                                category:"c4",
                                children:[]
                            },
                            {
                                category:"d4",
                                children:[]
                            }
                        ]
                    }
                ]
            },
            {
                category:"e2",
                children:[
                    {
                        category:"e3",
                        children:[]
                    }
                ]
            }
        ]
    }
];

    function findCategory(categoryName) {
        var trail = [];
       ...