A react map component wrapping neshan openlayers map.
``bash`
npm install @neshan-maps-platform/react-openlayers
npm install @neshan-maps-platform/ol
`bash`
yarn add @neshan-maps-platform/react-openlayers
yarn add @neshan-maps-platform/ol
`jsx
import {useEffect, useRef} from "react"
import {Map} from "@neshan-maps-platform/ol"
import NeshanMap, {NeshanMapRef} from "@neshan-maps-platform/react-openlayers"
function App() {
const mapRef = useRef
const onInit = (map: Map) => {
map.setMapType("osm-bright")
map.switchTrafficLayer(true)
}
useEffect(() => {
if (mapRef.current?.map) {
mapRef.current?.map.switchTrafficLayer(true)
mapRef.current?.map.setMapType("standard-night")
}
}, [])
return (
export default App
`
@neshan-maps-platform/react-openlayers` is written in TypeScript with complete definitions.