reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
v 2020-05-05T03:16:09.365800Z

Correct!

kenny 2020-05-05T03:19:43.366300Z

Are there any trade offs with doing so?

v 2020-05-05T03:22:01.366500Z

Not that I know of

v 2020-05-05T03:42:31.369Z

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.

v 2020-05-05T14:07:11.375500Z

@thheller Hi Thomas, any thoughts on this topic?

thheller 2020-05-05T15:43:17.377Z

sorry don't use or follow reagent/react that closely anymore? looks to me like you are using the wrong option key as @victorbjelkholm429 said?

v 2020-05-05T16:02:05.377300Z

No I tried that and it didnt work, so I thought may be it was because of shadow-cljs compiler

thheller 2020-05-05T16:02:45.377500Z

shadow-cljs is a build tool using the regular clojurescript compiler. so no that is rather unlikely.

v 2020-05-05T22:46:00.380400Z

Okay, I figured it out, it should have been :functional-components?

👍 1
victorb 2020-05-06T16:51:14.385600Z

heyo 😉

victorb 2020-05-05T06:20:53.369600Z

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

Jakob Durstberger 2020-05-05T08:13:26.372700Z

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?

2020-05-05T09:50:55.374100Z

I was wondering if anyone knows what the configurable compiler mentioned in the project for https://www.clojuriststogether.org/projects/ would entail?

2020-05-05T09:52:03.374400Z

Could it mean for example we can use https://github.com/borkdude/sci as a compiler (environment) for Reagent?

2020-05-05T09:52:42.374700Z

(I would love that :))

juhoteperi 2020-05-05T09:53:18.375200Z

(https://github.com/reagent-project/reagent/issues/495)

2020-05-05T15:25:10.375700Z

@juhoteperi Thank you!

2020-05-05T15:30:50.376300Z

Would it be possible to mix functional and class components?

juhoteperi 2020-05-05T15:35:32.376400Z

Yes. The :f> shortcut in the master makes this very easy.

juhoteperi 2020-05-05T15:36:10.376600Z

Or if you make function components the default, create-class will create class component.

2020-05-05T15:40:03.376800Z

btw @juhoteperi 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)

2020-05-05T17:51:33.377900Z

so we could mix the old and new code easily? I can't wait for this 🙂 Do you have an example?

2020-05-05T17:51:50.378100Z

Thanks a lot for maintaining the library by the way!

2020-05-05T20:30:28.379300Z

Ran my first reagent + electron app today!

2020-05-05T21:36:29.379500Z

congrats!

v 2020-05-05T22:59:40.383400Z

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?