Code styling fixes
This commit is contained in:
15
front/src/components/MapClickHandler.tsx
Normal file
15
front/src/components/MapClickHandler.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import { useMapEvent } from 'react-leaflet'
|
||||
import { LatLng } from 'leaflet'
|
||||
|
||||
import { SetState } from '../utils/types'
|
||||
|
||||
function MapClickHandler({ setPosition }: { setPosition: SetState<LatLng> }) {
|
||||
const map = useMapEvent('click', (e) => {
|
||||
setPosition(e.latlng)
|
||||
map.setView(e.latlng)
|
||||
})
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export default MapClickHandler
|
Reference in New Issue
Block a user