JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://unpkg.com/three@0.108.0/build/three.js"></script>
<script src="https://unpkg.com/three@0.108.0/examples/js/controls/OrbitControls.js"></script>
<div id="c" style="width: 200px; height: 200px;"></div>

JavaScript

const {
    CameraHelper,
    Color,
    BoxBufferGeometry,
    DirectionalLight,
    Fog,
    HemisphereLight,
    Mesh,
    MeshPhongMaterial,
    MeshStandardMaterial,
    PerspectiveCamera,
    PlaneBufferGeometry,
    Scene,
    WebGLRenderer
} = THREE;


let camera, container, controls, renderer, scene;

function init() {

    container = document.querySelector('#c');

    scene = new Scene();
    scene.background = new Color(0xf1f1f1);
    scene.fog = new Fog(0xf1f1f1, 20, 100);

    createCamera();
    createControls();
    createLights();
    // loadModels();
    createRenderer();

    renderer.setAnimationLoop(() => {
        update();
        render();
    })
}

function createCamera() {
    camera = new PerspectiveCamera(
        35,
        container.clientWidth / container.clientHeight,
        0.1,
        100
    );

    camera.position.set(-3, 3, 3);
}

function createControls() {

    controls = new THREE.OrbitControls(camera, container);

    controls.minDistance = 3;
    controls.maxDistance = 6;
    controls.maxPolarAngle = Math.PI / 2;
    controls.minPolarAngle = 0;
    controls.enableDamping = true;
    controls.dampingFactor = 0.1;
    controls.enablePan = false;

}

function createLights() {

    const ambientLight = new HemisphereLight(
        0xddeeff,
        0x202020,
        5
    );

    const mainLight = new DirectionalLight(
        0xffffff,
        5
    );
    mainLight.position.set(10, 10, 10);
    mainLight.intensity = .6;
    mainLight.target.position.set(0, -6, 0);
    mainLight.castShadow = true;

    scene.add(mainLight.target);
    scene.add(ambientLight, mainLight);

    //Create a helper for the shadow camera (optional)
    //const helper = new CameraHelper( mainLight.shadow.camera );
    //scene.add( helper );
}

function loadModels() {
    
    const loader = new THREE.GLTFLoader();
    const defaultMaterial = new MeshPhongMaterial({
        color: 0x444488,
        shininess: 10
    });

    let model;

    const...