This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-01
Channels
- # announcements (11)
- # babashka (71)
- # beginners (34)
- # calva (25)
- # chlorine-clover (38)
- # cider (13)
- # clj-kondo (1)
- # cljsrn (2)
- # clojure (40)
- # clojure-australia (4)
- # clojure-europe (16)
- # clojure-france (3)
- # clojure-nl (4)
- # clojure-uk (16)
- # clojurescript (27)
- # conjure (2)
- # core-async (41)
- # core-logic (3)
- # cursive (1)
- # data-science (1)
- # datomic (16)
- # depstar (19)
- # emacs (7)
- # fulcro (33)
- # graalvm (4)
- # honeysql (20)
- # hugsql (4)
- # jobs (1)
- # juxt (4)
- # off-topic (48)
- # pathom (41)
- # reagent (9)
- # reitit (19)
- # remote-jobs (1)
- # shadow-cljs (20)
- # startup-in-a-month (2)
- # tools-deps (29)
- # vim (3)
- # xtdb (30)
Hi, I got kinda a beginners question but I can't seem to figure this out. I'm trying to use a date-picker on my web-page. (https://github.com/wojtekmaj/react-date-picker#readme) But it keeps giving me this error (the date-picker is inside an element called search-bar)
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of `app.components.date_picker.date_picker`.
in app.components.date_picker.date_picker (created by app.components.search_bar.search_bar)
This is the code for my date-picker:
(ns app.components.date-picker
(:require [reagent.core :as r]
[re-frame.core :as rf]
[clojure.string :as str]
["react-date-picker" :refer [DatePicker]]))
(defn date-picker []
(let [on-change (fn [d] ())
value (js/Date.)]
[:> DatePicker {:onChange on-change
:value value}]))
DatePicker
is undefined, most likely. Probably because the :require
vector is incorrect.
ok, thx ill check that 🙂
dont exactly see whats wrong about it :s
Just to make sure, put (js/console.log DatePicker)
right after the ns form and see what it prints out.
If you confirm that it's undefined, try replacing the require vector with ["react-date-picker" :as date-picker]
and then check what date-picker
contains and try to go from there. In the end, you might need use :as
or :default
(in case you're using shadow-cljs; something else otherwise).
using shadow-cljs indeed. Ill try it when I get home 🙂 thx
In this case, you should consult the table in this section: https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
Do note that it might be wrong in rare cases, so when it doubt just log the :as
require to figure out what to use.
thanks 🙂
Hey, I fixed it by ["react-date-picker" :default DatePicker]. I'll read up on the userguide you send me about shadowcljs and npm packages. Thanks for helping m8 🙂