JSFiddle - React, Tailwind, and code Playground

HTML

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>

<!-- tab navs -->
                  <ul class="nav nav-tabs nav-pills nav-fill" id="postsTab" role="tablist">
                    <li class="nav-item" role="presentation"><button aria-controls="popular" aria-selected="true" class="nav-link active" data-bs-target="#popular" data-bs-toggle="tab" id="popular-tab" role="tab" type="button">Popular</button></li>
                    <li class="nav-item" role="presentation"><button aria-controls="recent" aria-selected="false" class="nav-link" data-bs-target="#recent" data-bs-toggle="tab" id="recent-tab" role="tab" type="button">Recent</button></li>
                  </ul>
                  <!-- tab contents -->
                  <div class="tab-content" id="postsTabContent">
                    <!-- loader -->
                    <div class="lds-dual-ring"></div>
                    <!-- popular posts -->
                    <div aria-labelledby="popular-tab" class="tab-pane fade show active my-4" id="popular" role="tabpanel">
                      <!-- post -->
                      <div class="post post-list-sm circle d-flex align-content-center mt-2">
                        <div class="thumb circle">
                          <a href="blog-single.html">
                            <div class="inner">
                              <img src="assets/img/post-3.jpg" alt="post-title" class="img-fluid" />
                            </div>
                          </a>
                        </div>
                        <div class="details clearfix ms-2">
                          <h6...

CSS

.tab-content {
  position: relative;
}
.tab-content .lds-dual-ring {
  display: inline-block;
  position: absolute;
  width: 40px;
  height: 40px;
  top: 50%;
  left: 50%;
  visibility: hidden;
  opacity: 0;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  -webkit-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
  z-index: 1;
}

.tab-content .lds-dual-ring.loading {
  visibility: visible;
  opacity: 1;
}

.tab-content .lds-dual-ring::after {
  content: " ";
  display: block;
  width: 40px;
  height: 40px;
  margin: 8px;
  border-radius: 50%;
  border: 3px solid;
  border-color: #FE4F70 transparent #FE4F70 transparent;
  -webkit-animation: lds-dual-ring 1.2s linear infinite;
          animation: lds-dual-ring 1.2s linear infinite;
}

@-webkit-keyframes lds-dual-ring {
  0% {
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}

@keyframes lds-dual-ring {
  0% {
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}

.tab-content .tab-pane {
  opacity: 1;
  -webkit-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
}

.tab-content .tab-pane.loading {
  opacity: 0.3;
}

JavaScript

const tabPane = document.querySelector(".tab-pane");
const dualRing = document.querySelector(".lds-dual-ring");
const tabs = [...document.querySelectorAll('[data-bs-toggle="tab"]')];

for (let tab of tabs) {
  tab &&
    tab.addEventListener("click", () => {
      tabPane.classList.add("loading");
      dualRing.classList.add("loading");
      setTimeout(() => {
        tabPane.classList.remove("loading");
        dualRing.classList.remove("loading");
      }, 500);
    });
}