This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-05
Channels
- # announcements (7)
- # babashka (20)
- # beginners (130)
- # bristol-clojurians (1)
- # cider (14)
- # clj-kondo (7)
- # cljdoc (14)
- # cljs-dev (15)
- # cljsrn (16)
- # clojars (11)
- # clojure (190)
- # clojure-dev (4)
- # clojure-europe (7)
- # clojure-italy (9)
- # clojure-nl (3)
- # clojure-romania (6)
- # clojure-uk (51)
- # clojurescript (44)
- # component (4)
- # conjure (28)
- # cursive (1)
- # data-science (4)
- # datascript (1)
- # datomic (30)
- # duct (4)
- # emacs (1)
- # figwheel (4)
- # fulcro (56)
- # graalvm (4)
- # helix (51)
- # jackdaw (2)
- # jobs-discuss (12)
- # joker (4)
- # lambdaisland (1)
- # local-first-clojure (1)
- # meander (73)
- # mid-cities-meetup (2)
- # nrepl (4)
- # off-topic (43)
- # pathom (56)
- # re-frame (37)
- # reagent (26)
- # shadow-cljs (161)
- # slack-help (9)
- # spacemacs (1)
- # tools-deps (18)
- # xtdb (18)
So according to 1.0.0-alpha1
reagent release. We can now directly use hooks, without having to call r/as-element. Which is fantastic! However, when following this example https://github.com/reagent-project/reagent/blob/master/examples/functional-components-and-hooks/src/example/core.cljs on a shadow-cljs version 2.8.110
. I get this error saying that “hooks should be used only in a functional component.“. Does any one have any idea why this is happening.
could be that the option to create-compiler is :function-components?
, not :function-components
. See https://github.com/reagent-project/reagent/blob/master/CHANGELOG.md
@U05224H0W Hi Thomas, any thoughts on this topic?
sorry don't use or follow reagent/react that closely anymore? looks to me like you are using the wrong option key as @UEJ5FMR6K said?
No I tried that and it didnt work, so I thought may be it was because of shadow-cljs compiler
shadow-cljs is a build tool using the regular clojurescript compiler. so no that is rather unlikely.
Hello,
I am trying to use AWS Amplify Authentication in a re-frame app.
The lib provides a higher order component withAuthenticator
, I am trying to use reactify-component
and adapt-react-class
but unfortunately I get the following error:
> Uncaught TypeError: Failed to construct ‘HTMLElement’: Please use the ‘new’ operator, this DOM object constructor cannot be called as a function.
Here is my code:
(defn main-panel []
[:div
[:h1 "Hello" ]])
(def root-view
(reagent/adapt-react-class
(withAuthenticator
(reagent/reactify-component main-panel))))
(defn ^:dev/after-load mount-root []
(re-frame/clear-subscription-cache!)
(aws-config/configure)
(re-frame/dispatch-sync [::events/initialize-db])
(reagent/render [root-view]
(.getElementById js/document "app")))
Would anyone be able to help me out or point me in the right direction?I was wondering if anyone knows what the configurable compiler mentioned in the project for https://www.clojuriststogether.org/projects/ would entail?
Could it mean for example we can use https://github.com/borkdude/sci as a compiler (environment) for Reagent?
(I would love that :))
@U061V0GG2 Thank you!
btw @U061V0GG2 why is compiler not a good name? Because it happens at runtime? Is that a strict definition of what a compiler is? I think it can’t be an interpreter, because there is no new interpretation after the first “compile”. Compiler feels right to me? (Disclaimer: i didn’t study computer science so maybe I’m too flexible in these terms)
Would it be possible to mix functional and class components?
Yes. The :f>
shortcut in the master makes this very easy.
Or if you make function components the default, create-class
will create class component.
so we could mix the old and new code easily? I can't wait for this 🙂 Do you have an example?
Thanks a lot for maintaining the library by the way!
I've updated function-components example to also show the version with :f>
: https://github.com/reagent-project/reagent/blob/master/examples/functional-components-and-hooks/src/example/core.cljs
And react-sortable-hoc example shows the :r>
can be useful for interop: https://github.com/reagent-project/reagent/blob/master/examples/react-sortable-hoc/src/example/core.cljs#L36-L60
Ran my first reagent + electron app today!
congrats!
I saw that Reagent released couple of features recently, two of them being :f>
which is the short cut to create functional react components from reagent component and :r>
which does the opposite, without converting the props from js to clj like :>
macro does. I understand what they do, but I am having hard time understanding the in what cases they might be used?
I've updated function-components example to also show the version with :f>
: https://github.com/reagent-project/reagent/blob/master/examples/functional-components-and-hooks/src/example/core.cljs
And react-sortable-hoc example shows the :r>
can be useful for interop: https://github.com/reagent-project/reagent/blob/master/examples/react-sortable-hoc/src/example/core.cljs#L36-L60