This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-19
Channels
- # announcements (9)
- # babashka (11)
- # beginners (157)
- # calva (10)
- # cider (18)
- # clara (4)
- # clj-kondo (40)
- # cljsrn (8)
- # clojure (29)
- # clojure-europe (11)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-spec (4)
- # clojure-sweden (1)
- # clojure-uk (39)
- # clojurescript (32)
- # conjure (1)
- # core-async (2)
- # cursive (20)
- # datomic (7)
- # duct (9)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (24)
- # helix (1)
- # hoplon (20)
- # hugsql (3)
- # jackdaw (5)
- # jobs-discuss (7)
- # lambdaisland (1)
- # malli (5)
- # music (4)
- # off-topic (54)
- # parinfer (2)
- # pedestal (13)
- # re-frame (12)
- # reagent (22)
- # reitit (9)
- # shadow-cljs (89)
- # spacemacs (2)
- # xtdb (21)
I am having hard time converting this React Material UI component to Reagent.
<Chip deleteIcon={<CloseIcon />}/>
I tried doing this, but it doesn’t work.
[:> Chip {:deleteIcon [:> (r/as-element [:> CloseIcon])] }]
Any ideas?Unfortunately it does not work 😞
Nevermind
[:> Chip {:deleteIcon [:> CloseIcon]}]
worked. What I didn’t know (not mentioned in the doc) is that I had to pass the onDelete
function as a prop to make the Icon appear :man-facepalming:I am surprised it works: I thought you had to use lilactown solution in material-ui
Huh, I don't think that should work. Nothing is going to convert vectors in props to react elements. As-element is the correct way, as is used in the examples.
Hi there, I am trying to use Form-2 component to store the reagent state. As well as using react hooks to style my components. Unfortunately react hooks does not seem to mix well with. Here is the component. I have so far. Any ideas? 🙂
(defn multi-select [props]
(let [is-open? (r/atom false)
{:keys [onChange label options value]} (js->clj props :keywordize-keys true)
classes (use-styles)]
(fn [props]
(r/as-element
[:div
[:> Button {:on-click #(reset! is-open? true)}
label]]))))
@vishal.gautam it always helps to explain in detail what the wrong behavior is when looking for help
Okay so I am using a Material UI React Library in ClojureScript. In this project I am using reagent
version 1.0.0-alpha2
. I have also configured to support hooks. So the functionality that I am trying to build is a simple multi select menu component. When the user clicks the button, menu opens.. and the user can select w.e options… I am using reagent atom to store the logic to check if the menu is open or not. So the above component does just that, except that it does not have menu component added yet, only single button. I am simply trying to render the button on screen. However when I try to use this function, I don’t see the button at all
This is how I am using the component
[:> multi-select {:label "Cuisines"
:on-change #(println "HANDLE CHANGE")
:options ["Burgers" "Kebab" "Pizza" "Pasta"]
:value []}]
yes that looks correct, reading this issue: https://github.com/reagent-project/reagent/issues/494
Thank you, i converted it to hoc and it worked
the reagent docs don’t describe how to currently use hooks using the new compiler stuff 😕
I had to remove hooks and use hoc,, no luck with hooks 😞
I though you could use hooks with the new :f> keyword.