I'm importing a react component (using the :npm-deps support) and wrapping with the adapt-react-class adapter:
(:require [reagent.core :as reagent]
[react-helmet])
(def meta-tags* (reagent/adapt-react-class (aget react-helmet "default")))
(defn main-panel []
(let []
(fn []
[meta-tags*])))
This works fine for development, but when advanced compiler is on:
Uncaught TypeError: Cannot call a class as a function
Minimimal repo:
https://github.com/fbielejec/npm-deps-demo
meta-tags*
is a class, but you're trying to call it like a function by placing it inside the Reagent square braces i.e. meta-tags*
.
In the source code that you posted on GitHub, you also define a function called meta-tags
. It looks like you're accidentally calling meta-tags*
by mistake. Your full code (based on the Github demo) should read:
(ns app.views
(:require [reagent.core :as reagent]
[react-helmet]))
(def meta-tags* (reagent/adapt-react-class (aget react-helmet "default")))
(defn meta-tags [{:keys [:title :description]
:or {title "Some title"
description "some description"}}]
[meta-tags* {:id "app-meta-tags"}
[:title {:id "title" :title title}]
[:meta {:id "description" :content description}]])
(defn main-panel []
(let []
(fn []
[:div.container
[meta-tags] ; <- no * star!
[:h1 "Check for the meta-tags presence"]])))