JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.css">
<div id="map"></div>

CSS

#map {
  width: 640px;
  height: 480px;
}

JavaScript

var source = new ol.source.Vector();
var map = new ol.Map({
  view: new ol.View({
    center: [0, 0],
    zoom: 1
  }),
  layers: [
    new ol.layer.Tile({
      source: new ol.source.OSM()
    }),
    new ol.layer.Vector({
      source: source
    })
  ],
  target: 'map'
});

var geometry = new ol.geom.Polygon([
    // Outer Ring
    [
        [0, 0], [0, 40], [40, 40], [40, 0], [0, 0]
    ]
]);

geometry.transform('EPSG:4326', 'EPSG:3857');
var feature = new ol.Feature({
  geometry: geometry
});

source.addFeature(feature);