JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://threejs.org/build/three.js"></script>

<script id="vertexShader" type="x-shader/x-vertex">
			varying vec3 vColor;
			
			void main()	{
			
				vColor = color;
				gl_Position = vec4( position, 1.0 );
				
			}
</script>

<script id="fragmentShader" type="x-shader/x-fragment">
			varying vec3 vColor;
			
			void main()	{

        gl_FragColor = vec4( vColor, 1.0 );

			}
</script>

CSS

body {
	  margin: 0;
}

JavaScript

let camera, scene, renderer;

init();
animate();

function init() {

    camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );

    scene = new THREE.Scene();

    let geometry = new THREE.PlaneBufferGeometry();
		
		// generate color attribute
		
		const colors = [];
		const position = geometry.attributes.position;
		
		const color = new THREE.Color();
		
		for ( let i = 0; i < position.count; i ++ ) {
		
			color.setHex( 0xffffff * Math.random() );
			colors.push( color.r, color.g, color.b );
		
		}
		
		geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
		
		//
		
    var material = new THREE.ShaderMaterial( {
      vertexShader: document.getElementById( 'vertexShader' ).textContent,
      fragmentShader: document.getElementById( 'fragmentShader' ).textContent,
			vertexColors: THREE.VertexColors
  	} );

    const 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 );

}

function animate() {

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

}