This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-21
Channels
- # announcements (8)
- # babashka (12)
- # beginners (18)
- # biff (25)
- # calva (8)
- # clj-kondo (19)
- # clojure (53)
- # clojure-europe (3)
- # clojure-norway (3)
- # clojurescript (31)
- # emacs (9)
- # fulcro (12)
- # lsp (25)
- # membrane (1)
- # off-topic (58)
- # pathom (11)
- # pedestal (1)
- # proletarian (3)
- # re-frame (6)
- # releases (2)
- # shadow-cljs (7)
I am trying to use react-datepicker in a re-frame project.
Here’s a simple hiccup for the date picker.
[react-datepicker
{:selected (js/Date.)
:on-change #(js/alert "Date selected")}]
And I am getting the following error:
Invalid Hiccup form: [#js {:CalendarContainer #object[Br], :default #object[r$jscomp$1], :getDefaultLocale #object[Jt], :registerLocale #object[Function], :setDefaultLocale #object[Function]} {:selected #inst “2023-01-21T16:34:55.641-00:00", :on-change #object[Function]}]
What is the issue here?
And also, is there any other generic date-picker you’d recommend?
Thanks!
You need to add :> before react-datepicker so Reagent knows to treat it as a react component and not as hiccup directive
Thanks valtteri. It now gives me this: Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. Sorry for the noob questions
To me it works with this kind of require and usage
(ns browser.main
(:require ["react-datepicker$default" :as DatePicker]
[reagent.core :as r]
[reagent.dom :as rdom]))
(defn my-comp []
[:> DatePicker {}])
The ClojureScript cheatsheet, linked from the official docs, seems to be https://cljs.info/cheatsheet/ which hasn't been updated for a couple of years. Is that still considered the "definitive" version for ClojureScript? The Clojure cheatsheet has become part of the official docs now at https://clojure.org/api/cheatsheet
Tagging @U050XCE7C
I created the ClojureScript cheatsheet in 2016 as a project to help learn the language and generally improve CLJS documentation. It has seen a few minor improvements since then, but nothing too major.
Is there something that needs an update?
Apart from a few somewhat recent issues in the bug tracker, there have been quite a few changes since 1.10.439: https://github.com/clojure/clojurescript/blob/master/changes.md Although I don't feel like I'm in a position to decide what exactly should make its way into the cheat sheet and what should be left out.
No idea - I don't follow cljs - but I'm updating https://clojure-doc.org and it was pointing to Fogus's old cheat sheet so I wanted to check yours was the near-official version these days.
@U050XCE7C If you feel that doing it all by yourself is too much, I can sieve through the changelog and make a list of things that have a non-0 potential of being useful in a cheat sheet.
> I can sieve through the changelog and make a list of things that have a non-0 potential of being useful in a cheat sheet Sure - this couldn't hurt 😁
> I don't feel like I'm in a position to decide what exactly should make its way into the cheat sheet and what should be left out. It definitely is a job of content curation; deciding what to include, what to leave out, etc. I took inspiration from the Clojure cheatsheet at the time, mainly leaving out the items that were JVM-specific.
> it was pointing to Fogus's old cheat sheet so I wanted to check yours was the near-official version these days I don't think it could hurt to include a link to both Fogus's and mine. I think mine is sort of the de facto standard since I titled it "ClojureScript Cheatsheet" and it has been around for a few years.
Although the project has not seen a lot of commits recently, I fully intend on hosting and keeping the ClojureScript cheatsheet around for a long time. The goal is to be "stable like Clojure" 🤓
Fogus's repo hasn't seen an update since 2013 so it's really outdated I think?
Just to confirm, you are referring to this? https://github.com/readevalprintlove/clojurescript-cheatsheet
That was what was linked from CDS yes
Not updated since 2013?
Yeah - it's a bit outdated on a few items.
Oh, so the cheat sheet is not based on CLJS 1.10.439 (which its project.clj
mentions) but rather on some older reference?
A lot of things that were on CDS were dead/outdated so my initial focus is just removing all that cruft in order to make it easier to maintain what's left:grin:
Chris's is "only" two years since last update. Fogus's is ten years since an update.
Right, but the latest commit date doesn't really tell us that it was regarding the latest CLJS version at the time - that's what I meant by my question.
> Oh, so the cheat sheet is not based on CLJS 1.10.439 (which its project.clj
mentions) but rather on some older reference?
The CLJS version listed in project.clj
for my cheatsheet is unrelated to the documentation (confusing - I know). The project itself is built using CLJS, and using that version. But the documentation files are a separate thing.
Likely I could bump the CLJS version for my cheatsheet to the latest and nothing would change.
Note that the https://cljs.github.io/api/ project (which is intended to be a full API reference for ClojureScript) does get it's information from a specific CLJS version: https://cljs.github.io/versions