JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
  <div class="part part1"></div>
  <div class="part part2"></div>
</div>

CSS

.container {
  background: red;
  width: 30rem;
  height: 30rem;
  position: relative;
}

.part {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.part1 {
  background: yellow;
  clip-path: polygon(0 0, 0% 100%, 100% 0);
}

.part2 {
  background: blue;
  clip-path: polygon(100% 100%, 0% 100%, 100% 0);
}