JSFiddle - React, Tailwind, and code Playground

by amrendra kumar

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>

JavaScript

let terms = [
    {
        "uid": "test",
        "name": "Test",
        "parent_uid": null,
        "depth": 1,
        "created_at": "2023-11-22T07:32:13.923Z",
        "created_by": "blt88d0894f532cf72b",
        "updated_at": "2023-11-22T07:32:13.923Z",
        "updated_by": "blt88d0894f532cf72b",
        "taxonomy_uid": "qweqweqwe",
        "ancestors": [
            {
                "uid": "qweqweqwe",
                "name": "qweqweqwe",
                "type": "TAXONOMY"
            }
        ]
    },
    {
        "uid": "test",
        "name": "test",
        "parent_uid": "dfs",
        "depth": 2,
        "created_at": "2023-12-16T23:31:56.941Z",
        "created_by": "blt1de032691636ef76",
        "updated_at": "2023-12-16T23:32:12.719Z",
        "updated_by": "blt1de032691636ef76",
        "taxonomy_uid": "sports",
        "ancestors": [
            {
                "uid": "sports",
                "name": "Sports",
                "type": "TAXONOMY"
            },
            {
                "uid": "dfs",
                "name": "dfs"
            }
        ]
    },
    {
        "uid": "test16",
        "name": "test16",
        "parent_uid": null,
        "depth": 1,
        "created_at": "2023-12-13T16:08:54.246Z",
        "created_by": "blt1de032691636ef76",
        "updated_at": "2023-12-13T16:08:54.246Z",
        "updated_by": "blt1de032691636ef76",
        "taxonomy_uid": "taxonomy_1",
        "ancestors": [
            {
                "uid": "taxonomy_1",
                "name": "ttttTaxonomy1Taxonomy1Taxonomy1Taxonomy1sddfsdfsdf",
                "type": "TAXONOMY"
            }
        ]
    },
    {
        "uid": "test1",
        "name": "test1",
        "parent_uid": null,
        "depth": 1,
        "created_at": "2023-12-13T16:04:23.869Z",
        "created_by": "blt1de032691636ef76",
        "updated_at": "2023-12-13T16:04:23.869Z",
        "updated_by": "blt1de032691636ef76",
        "taxonomy_uid": "taxonomy_1",
       ...