This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-13
Channels
- # announcements (1)
- # babashka (41)
- # beginners (194)
- # calva (14)
- # chlorine-clover (2)
- # cider (32)
- # circleci (9)
- # cljsrn (10)
- # clojure (110)
- # clojure-australia (1)
- # clojure-berlin (2)
- # clojure-dev (39)
- # clojure-europe (42)
- # clojure-france (3)
- # clojure-nl (19)
- # clojure-spec (22)
- # clojure-uk (23)
- # clojurescript (21)
- # conjure (41)
- # datomic (33)
- # depstar (16)
- # duct (46)
- # events (1)
- # fulcro (17)
- # graphql (14)
- # jobs (6)
- # jobs-discuss (9)
- # leiningen (6)
- # malli (29)
- # off-topic (21)
- # pathom (7)
- # portal (1)
- # rdf (81)
- # re-frame (3)
- # reagent (12)
- # reitit (2)
- # remote-jobs (1)
- # rum (1)
- # shadow-cljs (60)
- # specter (1)
- # sql (13)
- # tools-deps (23)
- # vrac (1)
- # yada (19)
I’m trying to translate this piece of react-bootstrap code
<Dropdown as={NavItem}>
<Dropdown.Toggle as={NavLink}>Click to see more…</Dropdown.Toggle>
<Dropdown.Item>Hello there!</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>;
from https://react-bootstrap.netlify.app/components/navs/#using-dropdownsMy question is how can I build the {NavItem}
part?
thanks @U2FRKM4TW I didn’t work that way but it’s working now, I just passed the element
@UEJ5FMR6K why do you say it is not needed? Dropdown, Nav.Item, etc are react classes from React-Bootstrap library and they need to “read” by reagent . FYI: I tried removing the :>
and it didn’t work.
@U9BUENJ1F Are you using something like react-bootstrap? It has a NavDropdown component https://react-bootstrap.github.io/components/navs/#nav-dropdown-props
@U07GPFFAS, yes, I’m using react-bootstrap, my problem with NavDropdown was that I needed an Image as the trigger to open the dropdown, and the only way was using the title prop but I don’t know how to write that in clojurescript
but the code I posted earlier works the same, and the Dropdown.Toggle can receive a child image, icon in this case
The react-bootstrap docs say title
is a node
as “The content of the non-toggle Button.” which is kind of vague but I presume it means a DOM node. Potentially you could create the icon and use :ref attribute to get the DOM node of the icon and pass that in. But that is kind of funky. Did find this react-bootstrap example https://stackoverflow.com/a/45941992 You could probably use any react-icon component instead of Glyphicon. One of the comments shows how to use react-icons, which is what we use.