This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-28
Channels
- # beginners (35)
- # boot (5)
- # cider (16)
- # cljs-dev (22)
- # cljsrn (11)
- # clojars (1)
- # clojure (205)
- # clojure-uk (19)
- # clojurescript (76)
- # cursive (22)
- # duct (4)
- # editors (1)
- # emacs (4)
- # fulcro (1)
- # hoplon (3)
- # leiningen (5)
- # off-topic (25)
- # onyx (29)
- # other-languages (5)
- # parinfer (1)
- # re-frame (13)
- # reagent (8)
- # reitit (2)
- # shadow-cljs (3)
- # tools-deps (11)
- # vim (6)
how am I supposed to use reagent with a react library that expects children to be a fn? for example, react-dnd:
<DragDropContext onDragEnd={this.onDragEnd}>
<Droppable droppableId="droppable">
{(provided, snapshot) => (
<div
ref={provided.innerRef}
style={getListStyle(snapshot.isDraggingOver)}
>
i’m not sure the proper combination of as-element or adapt-react-class, so something like this doesn’t work:
[(r/adapt-react-class DragDropContext) ...
[(r/adapt-react-class Droppable) ...
(fn [pr sn]
[:div ...])]]
because this is not valid reagent 😕@lwhorton you may have to use reactify component
(let [decorator (react-dnd/DragDropContext html5-backend/default)]
[(reagent/adapt-react-class
(decorator (reagent/reactify-component router-component)))])))
there are a couple of examples here https://github.com/reagent-project/reagent/blob/master/docs/InteropWithReact.md#example-decorator-higher-order-components
but basically you need to run your reagent-side stuff through reactify component or as-element before passing it to react