This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-27
Channels
- # announcements (2)
- # beginners (85)
- # boot (4)
- # calva (4)
- # cider (14)
- # cljdoc (8)
- # cljs-dev (5)
- # cljsrn (10)
- # clojure (101)
- # clojure-europe (1)
- # clojure-italy (6)
- # clojure-nl (12)
- # clojure-spec (4)
- # clojure-uk (71)
- # clojurescript (119)
- # core-async (20)
- # cursive (1)
- # datascript (2)
- # duct (3)
- # emacs (19)
- # fulcro (150)
- # graphql (1)
- # hoplon (2)
- # instaparse (2)
- # jobs (1)
- # jobs-discuss (11)
- # joker (9)
- # luminus (6)
- # lumo (1)
- # off-topic (33)
- # onyx (1)
- # quil (1)
- # re-frame (23)
- # reagent (11)
- # robots (2)
- # rum (6)
- # sql (1)
- # test-check (10)
- # unrepl (1)
Is it possible to use a react hook in reagent? A library has provided a helper hook but I can't figure out how to use it.
I think I remember an example @juhoteperi posted of creating a functional component using reagent as just a hiccup interpreter
(defn MyComponent [props] ; <— props is a JS object
(let [[count set-count] (react/useState 0)]
(reagent.core/as-element [:div {:on-click #(set-count inc)} count])))
Thanks, I don't understand though. Both my cljs and react are pretty basic. I'm trying to translate this - https://konvajs.org/docs/react/Images.html but I'm getting stuck in the js->cljs translation. I was hoping the hook would save me!
Reagent shines when you don’t need to do much interop with regular React components/hooks/libraries
if you’re interested, I created a library called #hx which serves that use case more. https://github.com/Lokeh/hx