-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Description
I've been wondering how I can start the drawing as soon as I display the map. I have a field that expands to reveal the map. So my solution was this:
useEffect(() => {
const target = document.querySelector(".leaflet-draw-draw-polygon")
if (active && target) {
target.dispatchEvent(new Event("click"))
}
}, [active])
active is a prop that I pass from the parent component and it's a boolean.
I'm curious who else might have some feedback. Thanks in advance
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels