I call a js function using component-did-mount\:
(def load-map (with-meta identity
{:component-did-mount
loadMap}))
(defn map []
[load-map [:div {:id "this-div"} "hello"]]
)
But only want to call loadMap once per page load. :on-mount doesn't work
loadMap can't be called directly on the page load in an effects handler because this-div needs to be mounted before loadMap is called because loadMap accesses the div using the this-div idthe error is:
You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.
cj @ js?key=AIzaSyD1r7IEvvf6w8FlHu3k__MfQzY&callback=initMap:138
ij @ js?key=AIzaSyD1r7IEvvf6w8FlHu3k__MfQzY&callback=initMap:135
google.maps.Load @ js?key=AIzaSyD1r7IEvvf6w8FlHu3k_hP_oJwW4_MfQzY&callback=initMap:14
(anonymous) @ js?key=AIzaSyD1r7IEvvf6w8FlHu3k_hP_oJwW4_MfQzY&callback=initMap:227
(anonymous) @ js?key=AIzaSyD1r7IEvvf6w8FlHu3k_hP_oJwW4_MfQzY&callback=initMap:227