clojure - Adding Google Maps to Luminus Reagent page? -


i'd add page containing google maps component luminus application can't figure out how this. i've tried follow reagent google maps guide map won't show.

this clojurescript code i've tried:

(ns test.maps   (:require [reagent.core :as r]))  (defn home-render []   [:div {:style {:height "300px"}}])  (defn home-did-mount [this]   (let [map-canvas (r/dom-node this)         map-options (clj->js {"center" (google.maps.latlng. -34.397, 150.644)                               "zoom"   8})]     (js/google.maps.map. map-canvas map-options)))  (defn map-page []   [:script {:type "text/javascript" :src "https://maps.googleapis.com/maps/api/js?key=<mykey>"}]   [:div.container    [:div.row     [:div.col-md-12      (r/create-class {:reagent-render      home-render                       :component-did-mount home-did-mount})]]]) 

i suspect not right way add script tags.

so question how add google maps component lumius application?

move [:script {:type "text/javascript" :src "https://maps.googleapis.com/maps/api/js?key=<mykey>"}] static html page, in reagent example linked to.

if developer console of browser, getting app.js:337 uncaught referenceerror: google not defined.

placing script tags in reagent components bad idea because tags dynamic , cause script loaded several times through lifetime of page. want load script directly when page rendered first time.


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -