This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-06
Channels
- # announcements (1)
- # babashka (7)
- # beginners (93)
- # bristol-clojurians (1)
- # cider (7)
- # clj-kondo (42)
- # cljs-dev (9)
- # clojure (67)
- # clojure-europe (4)
- # clojure-france (4)
- # clojure-germany (2)
- # clojure-italy (3)
- # clojure-nl (10)
- # clojure-uk (62)
- # clojurescript (11)
- # clojurex (3)
- # conjure (77)
- # cursive (16)
- # datomic (105)
- # docker (4)
- # editors (3)
- # events (5)
- # fulcro (34)
- # jobs (1)
- # juxt (7)
- # kaocha (7)
- # lambdaisland (3)
- # lein-figwheel (2)
- # leiningen (19)
- # malli (14)
- # meander (6)
- # mid-cities-meetup (6)
- # off-topic (20)
- # pedestal (2)
- # reagent (17)
- # reitit (7)
- # remote-jobs (1)
- # shadow-cljs (17)
- # spacemacs (23)
- # specter (2)
- # tools-deps (34)
Hello,
i need help how to include and use react-datepicker in clojurescript project i got error saying the cljsjs is not supported and when i try to solve it i failed.. any idea any one please??
You're using shadow-cljs, right? If so, there are examples of how to include NPM packages in its documentation.
yes using shadow-cljs, i required the package as follows:
(:require [reagent.core :as r] ["react-datepicker" :as datePicker ] ) But i dont know how to use it.. i tried (defn date-picker [] [:div [datePicker]] )
You need to read this section: https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
If something doesn't work, just (js/console.log datePicker)
and try to reason about what's wrong with the import.
okay, the import worked and i got the input field with the selected today's date but when i click on it, it doesnt show the calendar and nothing happens [:div [:> js/DatePicker {:selected (js/Date.)}]]
If I have a function to specify!
IFn
on an object:
(defn specify-invoke [x invoke-fn]
(specify! x
IFn
(-invoke
([this]
(invoke-fn))
([this a]
(invoke-fn a))
([this a b]
(invoke-fn a b))
;;A lot more arities
([this a b c d e f g h i j k l m n o p q r s t]
(invoke-fn a b c d e f g h i j k l m n o p q r s t))
([this a b c d e f g h i j k l m n o p q r s t rest]
(invoke-fn a b c d e f g h i j k l m n o p q r s t rest)))))
And I do this for a lot of objects, such as every dom element on my page is this going to have a major code size/performance impact relative to extending a type to the protocol? Or is this the kind of thing that gets optimized/minimized by the compiler?i think it should be fine, you can check the compiled output here: http://app.klipse.tech/?js_only=1
the code footprint shouldn't be much, but there will be a few function instances created for each call to specify-invoke, so that would increase the memory footprint of the app, but like all perf issues, the answer is "it depends". what are the constraints and expected use cases etc.