Fork me on GitHub
#cljsjs
<
2018-08-07
>
Wilson Velez01:08:05

Hi, I’m very new at cljs, I’m trying to use the cljsjs/react-datepicker, but I haven’t been able to do it, these are my dependencies

(defproject in-specie-editor "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.9.0"]
                 [org.clojure/clojurescript "1.10.238"]
                 [binaryage/devtools "0.9.9"]
                 [reagent "0.8.0-alpha2"]
                 [re-frame "0.10.5"]
                 [cljs-ajax "0.7.3"]
                 [day8.re-frame/http-fx "0.1.5"]
                 [cljs-common "0.1.0-SNAPSHOT"]
                 [cljsjs/react-datepicker "1.5.0-0"]]
                 [day8.re-frame/re-frame-10x "0.3.1-react16"]
and the require section of the view.cljs
(ns in_specie_editor.views
  (:require [re-frame.core :as re-frame :refer [subscribe]]
            [in_specie_editor.config :as config :refer [debug?]]
            [in_specie_editor.utils :as utils]
            [cljs.pprint :as pprint]
            [clojure.string :as str]
            [cljs-common.components.select :as select]
            [reagent.core :as reagent]
            [cljsjs.react-datepicker]))
I define the datepicker as it is in the documentation
(def date-picker (.createFactory js/React js/DatePicker))
and then when I try to use it
[date-picker {:selected  received-at
                           :on-change #(received-at-handler (js->clj %))}]

Wilson Velez01:08:10

but I’m getting this error

react-dom.inc.js:17859 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of `bound createElement`.
    at invariant