JSFiddle - React, Tailwind, and code Playground

CSS

body {
	  margin: 0;
}

JavaScript

import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.125.2/build/three.module.js';
import * as DAT from 'https://cdn.jsdelivr.net/npm/dat.gui@0.7.7/build/dat.gui.module.js';

let camera, scene, renderer;

let mesh;

const params = {
	duplicate: function() {
	
		const duplicate = mesh.clone();
		duplicate.material = duplicate.material.clone();
		duplicate.material.color.set( 0xffffff * Math.random() );
		duplicate.position.x = 2;
		scene.add( duplicate );
	
	}
}

init();
animate();

function init() {

    camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 10 );
    camera.position.z = 5;

    scene = new THREE.Scene();

    const geometry = new THREE.BoxGeometry();
    const material = new THREE.MeshBasicMaterial();

    mesh = new THREE.Mesh( geometry, material );
    scene.add( mesh );

    renderer = new THREE.WebGLRenderer( { antialias: true } );
    renderer.setSize( window.innerWidth, window.innerHeight );
    document.body.appendChild( renderer.domElement );
		
		//
		
		const gui = new DAT.GUI();
		gui.add( params, 'duplicate' );
		gui.open();

}

function animate() {

    requestAnimationFrame( animate );
    renderer.render( scene, camera );

}