This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-14
Channels
- # aleph (3)
- # announcements (1)
- # babashka (36)
- # babashka-sci-dev (4)
- # beginners (62)
- # biff (2)
- # calva (13)
- # cider (4)
- # clj-kondo (6)
- # cljdoc (17)
- # clojure (142)
- # clojure-dev (6)
- # clojure-europe (62)
- # clojurescript (20)
- # core-async (26)
- # cursive (18)
- # data-oriented-programming (9)
- # data-science (1)
- # datahike (18)
- # events (4)
- # fulcro (4)
- # graalvm (2)
- # hyperfiddle (15)
- # interop (1)
- # jobs-discuss (8)
- # leiningen (2)
- # lsp (91)
- # malli (1)
- # missionary (11)
- # nbb (65)
- # off-topic (50)
- # practicalli (2)
- # programming-beginners (4)
- # re-frame (18)
- # remote-jobs (1)
- # shadow-cljs (53)
- # spacemacs (1)
- # specter (2)
- # sql (17)
- # tools-build (63)
- # web-security (1)
- # xtdb (15)
Hi guys, I am sending a boolean value to a component, that when true, it would change colors for example, now this boolean changs values only when I click on another button in another component. Is there a way to make the first component rerender so it knows the boolean value is now true? (like useEffect in React)
It should already know about the change. If it doesn't, perhaps you're using a form-2 or a form-3 component without getting that boolean argument from the render function's args.
What himik said. Try making a minimal example of your code, and we’ll see if we can tell where it’s gone wrong.
Hi Im using MUI and trying to add icon to the menu list item, just like this:
<MenuItem>
<ListItemIcon>
<ContentCut fontSize="small" />
</ListItemIcon>
<ListItemText>Cut</ListItemText>
</MenuItem>
this is how my menu item loos in Clojurescript, how do I add the icon here:
[menu-item {:onClick copyLink} "Copy Link"]
I’ve no idea what those elements are, they’re not vanilla html. But generally, hiccup is just nested vectors.
[:div.my-menu-item
[:div.my-list-item-icon {:font-size "small"}]
[:div.list-item-text "Cut"]]
seems like the general direction that you want. (The above is free-hand, so not exactly what you want)Don’t expect the above to do anything, I’m just trying to demonstrate hiccup structure.
As soon as you’ve made something a component - that is, a function that returns hiccup - you control the arguments. You don’t have to name the arguments in any specific way, or have them be of specific types. You’re in control.
So your menu-item
can take whatever args you want.
If you want it to take other hiccup as an argument, you can.
So you can add the icon hiccup as an argument, or write it directly in the function (which is probably what you want in most cases)
Great 🙂 Hope it works out for you!
Has anybody tried using clj-kondo
with lint-staged
?
I have the following npm script:
"lint:clj": "shadow-cljs run clj-kondo.main/main --lint"
When I do npm run lint:clj -- src
, it works fine meaning it shows appropriate warnings/errors.
However, when I’m trying to use it with lint-staged as "*.{clj,cljs}": "npm run lint:clj --"
, it doesn't work as expected meaning it does not exit on warnings/errors.
Any ideas how can I make it work?
@islambeg There is a documented pre-commit hook here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/ci-integration.md#pre-commit-hook
Oh, thanks! overlooked it in the repo. Still, it’d be nice if there is a way to integrate clj-kondo into lint-staged as I use it anyway for html/css/js related things.
Hi, I have a div that I want to capture left and right clicks on I have this:
[:div.board-cell
{:on-click #(rf/dispatch-sync [:cell-click [x y]])
:onContextMenu (fn [e] (rf/dispatch-sync [:toggle-flag [x y]])
false)}
,,,]
It works, and I can left click and I get the :cell-click
firing ok, and I am capturing the right click and toggling the cell. But the context menu still appears. I thought the handling function returning false
would stop this, but nope.
How can I make it not show the context menu. I think maybe I have to set a property on e
but not sure what or how.