This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-14
Channels
- # announcements (2)
- # aws (12)
- # aws-lambda (5)
- # beginners (42)
- # calva (56)
- # cider (16)
- # clj-kondo (1)
- # cljs-dev (45)
- # cljsjs (1)
- # cljsrn (25)
- # clojure (171)
- # clojure-europe (3)
- # clojure-italy (16)
- # clojure-losangeles (2)
- # clojure-nl (49)
- # clojure-spec (2)
- # clojure-sweden (3)
- # clojure-uk (11)
- # clojurescript (84)
- # component (11)
- # core-async (12)
- # core-logic (2)
- # cursive (8)
- # datomic (41)
- # events (2)
- # fulcro (48)
- # graalvm (1)
- # graphql (1)
- # hoplon (12)
- # jackdaw (1)
- # jobs (1)
- # jobs-discuss (45)
- # joker (5)
- # keechma (10)
- # nyc (3)
- # off-topic (14)
- # pathom (16)
- # qa (1)
- # re-frame (22)
- # reagent (12)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (40)
- # spacemacs (3)
- # timbre (3)
- # tools-deps (29)
has anyone had problems using react JS libraries that use the new hooks feature with reagent?
i am completely stuck trying to get react-dnd
(https://github.com/react-dnd/react-dnd) working with reagent
calling a hook from the body of a render function (which i have verified is evaluating during a render) gives the following error:
Uncaught Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See for tips about how to debug and fix this problem.
at invariant ()
at Object.throwInvalidHookError ()
at Object.useRef ()
at Object.exports.useDrag ()
at Constructor.getfluentspanish$exercises$matching$item [as reagentRender] ()
at
at Object.reagent$impl$component$wrap_render [as wrap_render] ()
at Object.reagent$impl$component$do_render [as do_render] ()
at
at Object.reagent$ratom$in_context [as in_context] ()
So any libraries that call hooks are unusable from reagent?
Ahh - found the answer here: http://reagent-project.github.io/docs/master/ReactFeatures.html
need to use :>
to use the function as a react component, and wrap the response with as-element
@U4YGF4NGM Thank you very much for explaining the thing about reagent components turning into classes. That pointed me in the right direction to find the solution
i cannot find any evidence that there is more than one copy of react in the app
this is like the third time i've had to rewrite this feature i'm working on due to limitations of drag-and-drop in reagent