I use OpenLayers API Map in my project. I have no idea what is the correct way to use js code in react or vice verca?
Here is answer how to user markers in map, but I can't use it in my current code as I don't understand react sytax as well. Here is my code example with empty map.
import React, { Component } from 'react';
import { Map, layer, Layers } from 'react-openlayers';
import { Container } from 'react-bootstrap';
import { transform } from 'ol/proj';
import '../../styles/openlayers-map.css';
class OpenlayersMap extends Component {
render() {
return (
<Container className="map-container">
<Map view={{
center: transform([30, 50],
'EPSG:4326', 'EPSG:3857'),
zoom: 12,
maxZoom: 18,
minZoom: 4,
}}
>
<Layers>
<layer.Tile />
</Layers>
</Map>
</Container>
);
}
}
export default OpenlayersMap;
There is a sample of working js code provided Here. I will really appreciate for any help to use this code for my purpose